Files
deployd/test/model.test.js
Ritchie 6edfd0c188 tests
2011-10-13 20:53:20 -07:00

44 lines
716 B
JavaScript

// deps
require('spawn');
var Model = require('model')
, TestModel = Model.spawn({
collection: 'tests',
})
, data = {id: 1234, foo: 'bar', bat: 'baz'}
;
module.exports = {
'creating a new model': function(done, assert) {
TestModel
.spawn(data)
.notify(function(json) {
assert.eql(json, data);
})
.save()
;
},
'find and update': function(done, assert) {
TestModel
.spawn(data)
.notify(function(json) {
assert.eql(json, data);
})
.fetch()
;
},
'remove': function(done, assert) {
TestModel
.spawn(data)
.notify(function(json) {
assert.ok(json.removed);
})
;
}
}