Skip to content

Commit

Permalink
Updated plugins tests to use promises
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Sep 19, 2014
1 parent 546638a commit 44a861d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions test/plugins.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
var Database = require('../index.js');
var Model = Database.Model;
var Instance = Database.Instance;
var should = require('should');
var skmatc = require('skmatc');

describe('plugins', function() {
Expand All @@ -11,7 +7,7 @@ describe('plugins', function() {
function(schema, data, path) { return this.assert(data >= 0); })
};

it('should correctly validate models upon creation', function(done) {
it('should correctly validate models upon creation', function() {
var model = new Model({
plugins: [plugin],
db: {
Expand All @@ -21,12 +17,14 @@ describe('plugins', function() {
{ name: String, age: 'Positive' },
{});

model.insert({
return model.insert({
name: 'test', age: -1
}, function(err, instance) {
}).then(function(instance) {
should.fail();
}, function(err) {
should.exist(err);
should.not.exist(instance);
done();
err.isValidationError.should.be.true;
return Q();
});
});
});
Expand Down

0 comments on commit 44a861d

Please sign in to comment.