14

I've got a unit test like this:

(parsed.date).should.equal(new Date(2006,06,18,18,07));

Which fails with this message:

  AssertionError: expected 2006-07-19T00:07:00.000Z to be 2006-07-19T00:07:00.000Z
  + expected - actual

What am I doing wrong?

Sam Mikes
  • 10,438
  • 3
  • 42
  • 47

1 Answers1

18

Found it - I should be comparing dates with eql not equal.

Working code:

(parsed.date).should.eql(new Date(2006,06,18,18,07));

More at this link: https://github.com/visionmedia/should.js/issues/63 specifically comment https://github.com/visionmedia/should.js/issues/63#issuecomment-27626023

Sam Mikes
  • 10,438
  • 3
  • 42
  • 47