Fix assertion errors

This commit is contained in:
Loay 2017-05-01 00:24:15 -04:00
parent c80daae5a1
commit 87dd44dd59
2 changed files with 10 additions and 10 deletions

View File

@ -543,7 +543,7 @@ DataAccessObject.upsert = function(data, options, cb) {
const model = new Model({id: id}, {persisted: true});
model.updateAttributes(data, options, cb);
}
return;
return cb.promise;
}
var context = {

View File

@ -920,7 +920,7 @@ describe('manipulation', function() {
var unknownId = uid.fromConnector(db) || 123;
var post = {id: unknownId, title: 'a', content: 'AAA'};
Post.updateOrCreate(post, {validate: true}, (err) => {
err.statusCode.should.equal(404);
should(err).have.property('statusCode', 404);
done();
});
});
@ -929,20 +929,20 @@ describe('manipulation', function() {
var unknownId = uid.fromConnector(db) || 123;
var post = {id: unknownId, title: 'a', content: 'AAA'};
Post.updateOrCreate(post, {validate: false}, (err) => {
err.statusCode.should.equal(404);
should(err).have.property('statusCode', 404);
done();
});
});
it('fails when id does not exist in db & validate is false when using updateAttributes',
function(done) {
var unknownId = uid.fromConnector(db) || 123;
var post = new Post({id: unknownId});
post.updateAttributes({title: 'updated title', content: 'AAA'}, {validate: false}, (err) => {
err.statusCode.should.equal(404);
done();
function(done) {
var unknownId = uid.fromConnector(db) || 123;
var post = new Post({id: unknownId});
post.updateAttributes({title: 'updated title', content: 'AAA'}, {validate: false}, (err) => {
should(err).have.property('statusCode', 404);
done();
});
});
});
it('works on create if the request does not include an id', function(done) {
var post = {title: 'a', content: 'AAA'};