不要怂,就是干,撸起袖子干!

Commit 5c84dc0d by ekmartin

Add a test that checks that an error is thrown when Model.update() is called without a where-clause

Add instanceof check to error
1 parent 61be4f61
Showing with 13 additions and 0 deletions
......@@ -857,6 +857,19 @@ describe(Support.getTestDialectTeaser('Model'), function() {
});
describe('update', function() {
it('throws an error if no where clause is given', function() {
var User = this.sequelize.define('User', { username: DataTypes.STRING });
return this.sequelize.sync({ force: true }).then(function() {
return User.update();
}).then(function() {
throw new Error('Update should throw an error if no where clause is given.');
}, function(err) {
expect(err).to.be.an.instanceof(Error);
expect(err.message).to.equal('Missing where attribute in the options parameter passed to update.');
});
});
if (current.dialect.supports.transactions) {
it('supports transactions', function(done) {
Support.prepareTransactionTest(this.sequelize, function(sequelize) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!