Skip to content

Commit

Permalink
test(dao): bad filter for destroyAll
Browse files Browse the repository at this point in the history
  • Loading branch information
biniam committed Jul 23, 2018
1 parent 4d14c14 commit 7fb58ea
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ function selectFields(fields) {
}

/**
* Remove undefined values from the queury object
* Remove undefined values from the query object
* @param query
* @param handleUndefined {String} either "nullify", "throw" or "ignore" (default: "ignore")
* @returns {exports.map|*}
Expand Down
30 changes: 30 additions & 0 deletions test/basic-querying.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,36 @@ describe('basic-querying', function() {
});
});

describe('destroyAll', function() {
beforeEach(function resetFixtures(done) {
User.destroyAll(function() {
User.create([
{name: 'John'},
{name: 'Jane'},
{name: 'Mary'},
], done);
});
});

after(function deleteFixtures(done) {
User.destroyAll(done);
});

it('should not delete all for bad where object', function(done) {
User.destroyAll({where: {name: 'Test'}}, function(err, info) {
should.not.exist(err);
User.find({fields: 'name'}, function(err, users) {
users.should.containDeep([
{name: 'John'},
{name: 'Jane'},
{name: 'Mary'},
]);
done();
});
});
});
});

context('regexp operator', function() {
var invalidDataTypes = [0, true, {}, [], Function, null];

Expand Down

0 comments on commit 7fb58ea

Please sign in to comment.