Browse files

Fix date handling test by should

  • Loading branch information...
1 parent 25a0900 commit bd02687688d34c1de457e9d4aab11da5a81350b0 @wdavidw committed Oct 3, 2012
Showing with 15 additions and 15 deletions.
  1. +1 −1 package.json
  2. +9 −9 test/schema_temporal.coffee
  3. +5 −5 test/type_date.coffee
View
2 package.json
@@ -21,7 +21,7 @@
"each": "latest",
"mecano": "latest",
"mocha": "latest",
- "should": "0.6.0"
+ "should": "latest"
},
"contributors": [
{ "name": "David Worms", "email": "david@adaltas.com" }
View
18 test/schema_temporal.coffee
@@ -28,10 +28,10 @@ describe 'type', ->
should.not.exist err
# should v0.6.3 is broken with "instanceof Date"
# https://github.com/visionmedia/should.js/issues/65
- # (record.cdate instanceof Date).should.be.true
- # (record.mdate instanceof Date).should.be.true
- record.cdate.should.be.an.instanceof Date
- record.mdate.should.be.an.instanceof Date
+ (record.cdate instanceof Date).should.be.true
+ (record.mdate instanceof Date).should.be.true
+ # record.cdate.should.be.an.instanceof Date
+ # record.mdate.should.be.an.instanceof Date
next()
it 'should deal with update', (next) ->
@@ -48,10 +48,10 @@ describe 'type', ->
should.not.exist err
# should v0.6.3 is broken with "instanceof Date"
# https://github.com/visionmedia/should.js/issues/65
+ (record.cdate instanceof Date).should.be.true
+ (record.mdate instanceof Date).should.be.true
+ # record.cdate.should.be.an.instanceof Date
+ # record.mdate.should.be.an.instanceof Date
# (record.cdate is cdate).should.be.true
- # (record.cdate instanceof Date).should.be.true
- # (record.mdate instanceof Date).should.be.true
- record.cdate.should.eql cdate
- record.cdate.should.be.an.instanceof Date
- record.mdate.should.be.an.instanceof Date
+ record.cdate.getTime().should.eql cdate.getTime()
next()
View
10 test/type_date.coffee
@@ -75,27 +75,27 @@ describe 'type date', ->
, (err, record) ->
should.not.exist err
recordId = record.record_id
- record.a_date.should.eql date
+ record.a_date.getTime().should.eql date.getTime()
# Test all
Records.all (err, records) ->
should.not.exist err
records.length.should.equal 1
- records[0].a_date.should.eql date
+ records[0].a_date.getTime().should.eql date.getTime()
# Test update
date.setYear 2010
Records.update
record_id: recordId
a_date: date
, (err, record) ->
should.not.exist err
- record.a_date.should.eql date
+ record.a_date.getTime().should.eql date.getTime()
# Test list
Records.list (err, records) ->
should.not.exist err
records.length.should.equal 1
- records[0].a_date.should.eql date
+ records[0].a_date.getTime().should.eql date.getTime()
# Test list
Records.get records[0].record_id, (err, record) ->
should.not.exist err
- record.a_date.should.eql date
+ record.a_date.getTime().should.eql date.getTime()
next()

0 comments on commit bd02687

Please sign in to comment.