Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (48 sloc) 2 KB
should = require 'should'
try config = require '../conf/test' catch e
ron = require '../index'
describe 'type', ->
client = Users = null
before (next) ->
client = ron config
next()
after (next) ->
client.quit next
it 'should deal with create', (next) ->
Records = client.get
name: 'records'
temporal: true
properties:
record_id: identifier: true
date = new Date Date.UTC 2008, 8, 10, 16, 5, 10
Records.clear (err) ->
Records.create {}, (err, record) ->
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
next()
it 'should deal with update', (next) ->
Records = client.get
name: 'records'
temporal: true
properties:
record_id: identifier: true
date = new Date Date.UTC 2008, 8, 10, 16, 5, 10
Records.clear (err) ->
Records.create {}, (err, record) ->
cdate = record.cdate
Records.update record, (err, record) ->
should.not.exist err
# should v0.6.3 is broken with "instanceof Date"
# https://github.com/visionmedia/should.js/issues/65
(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
next()
Something went wrong with that request. Please try again.