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

Commit 163651b2 by Sushant

(tests) rejectOnEmpty feature

* Added tests for findOne, findById and find methods
1 parent 1ce1a2aa
Showing with 30 additions and 0 deletions
......@@ -935,5 +935,35 @@ describe(Support.getTestDialectTeaser('Model'), function() {
expect(spy.called).to.be.ok;
});
});
describe('kenophobic mode', function() {
it('throws error when record not found by findOne', function() {
return expect(this.User.findOne({
where: {
username: 'ath-kantam-pradakshnami'
}
}, {
kenophobic: true
})).to.eventually.be.rejectedWith(Sequelize.RecordNotFoundError);
});
it('throws error when record not found by findById', function() {
return expect(this.User.findById(4732322332323333232344334354234, {
kenophobic: true
})).to.eventually.be.rejectedWith(Sequelize.RecordNotFoundError);
});
it('throws error when record not found by find', function() {
return expect(this.User.find({
where: {
username: 'some-username-that-is-not-used-anywhere'
}
}, {
kenophobic: true
})).to.eventually.be.rejectedWith(Sequelize.RecordNotFoundError);
});
});
});
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!