Skip to content

Commit

Permalink
Add test for returnValues.output true
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaharHD committed Jun 25, 2020
1 parent 2153218 commit e6b2eaf
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/integration/model/update.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,23 @@ describe(Support.getTestDialectTeaser('Model'), () => {
});
}

if (_.get(current.dialect.supports, 'returnValues.output')) {
it('should return the updated record', function() {
return this.Account.create({ ownerId: 2 }).then(account => {
return this.Account.update({ name: 'FooBar' }, {
where: {
id: account.get('id')
},
returning: true
}).then(([, accounts]) => {
const firstAcc = accounts[0];
expect(firstAcc.ownerId).to.be.equal(2);
expect(firstAcc.name).to.be.equal('FooBar');
});
});
});
}

if (current.dialect.supports['LIMIT ON UPDATE']) {
it('should only update one row', function() {
return this.Account.create({
Expand Down

0 comments on commit e6b2eaf

Please sign in to comment.