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

Commit 90afc987 by Richard Comley

improves tests for count

1 parent 3078c192
Showing with 13 additions and 13 deletions
......@@ -1670,15 +1670,15 @@ describe(Support.getTestDialectTeaser('Model'), function() {
var options, aggregateSpy;
beforeEach(function () {
options = { where: ['username = ?', 'user1']};
options = { where: { username: 'user1'}};
aggregateSpy = sinon.spy(this.User, "aggregate");
});
afterEach(function () {
var optsArg = aggregateSpy.args[0][2];
expect(optsArg.where).to.deep.equal(['username = ?', 'user1']);
expect(aggregateSpy).to.have.been.calledWith(
sinon.match.any, sinon.match.any,
sinon.match.object.and(sinon.match.has('where', { username: 'user1'})));
aggregateSpy.restore();
});
......@@ -1687,9 +1687,9 @@ describe(Support.getTestDialectTeaser('Model'), function() {
options.limit = 5;
return this.User.count(options).then(function() {
var optsArg = aggregateSpy.args[0][2];
expect(optsArg.limit).to.equal(null);
expect(aggregateSpy).to.have.been.calledWith(
sinon.match.any, sinon.match.any,
sinon.match.object.and(sinon.match.has('limit', null)));
});
});
......@@ -1697,9 +1697,9 @@ describe(Support.getTestDialectTeaser('Model'), function() {
options.offset = 10;
return this.User.count(options).then(function() {
var optsArg = aggregateSpy.args[0][2];
expect(optsArg.offset).to.equal(null);
expect(aggregateSpy).to.have.been.calledWith(
sinon.match.any, sinon.match.any,
sinon.match.object.and(sinon.match.has('offset', null)));
});
});
......@@ -1707,9 +1707,9 @@ describe(Support.getTestDialectTeaser('Model'), function() {
options.order = "username";
return this.User.count(options).then(function() {
var optsArg = aggregateSpy.args[0][2];
expect(optsArg.order).to.equal(null);
expect(aggregateSpy).to.have.been.calledWith(
sinon.match.any, sinon.match.any,
sinon.match.object.and(sinon.match.has('order', null)));
});
});
});
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!