Add test case using updateAttributes
This commit is contained in:
parent
f1d10b47ce
commit
3c19beacbb
|
@ -913,7 +913,8 @@ describe('manipulation', function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe('updateOrCreate when forceId is true', function() {
|
||||
bdd.describeIf(connectorCapabilities.supportForceId !== false,
|
||||
'updateOrCreate when forceId is true', function() {
|
||||
var Post;
|
||||
before(function definePostModel(done) {
|
||||
var ds = getSchema();
|
||||
|
@ -942,6 +943,16 @@ describe('manipulation', function() {
|
|||
});
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
||||
it('works on create if the request does not include an id', function(done) {
|
||||
var post = {title: 'a', content: 'AAA'};
|
||||
Post.updateOrCreate(post, (err, p) => {
|
||||
|
|
Loading…
Reference in New Issue