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

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() { ...@@ -1670,15 +1670,15 @@ describe(Support.getTestDialectTeaser('Model'), function() {
var options, aggregateSpy; var options, aggregateSpy;
beforeEach(function () { beforeEach(function () {
options = { where: ['username = ?', 'user1']}; options = { where: { username: 'user1'}};
aggregateSpy = sinon.spy(this.User, "aggregate"); aggregateSpy = sinon.spy(this.User, "aggregate");
}); });
afterEach(function () { afterEach(function () {
var optsArg = aggregateSpy.args[0][2]; expect(aggregateSpy).to.have.been.calledWith(
sinon.match.any, sinon.match.any,
expect(optsArg.where).to.deep.equal(['username = ?', 'user1']); sinon.match.object.and(sinon.match.has('where', { username: 'user1'})));
aggregateSpy.restore(); aggregateSpy.restore();
}); });
...@@ -1687,9 +1687,9 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -1687,9 +1687,9 @@ describe(Support.getTestDialectTeaser('Model'), function() {
options.limit = 5; options.limit = 5;
return this.User.count(options).then(function() { return this.User.count(options).then(function() {
var optsArg = aggregateSpy.args[0][2]; expect(aggregateSpy).to.have.been.calledWith(
sinon.match.any, sinon.match.any,
expect(optsArg.limit).to.equal(null); sinon.match.object.and(sinon.match.has('limit', null)));
}); });
}); });
...@@ -1697,9 +1697,9 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -1697,9 +1697,9 @@ describe(Support.getTestDialectTeaser('Model'), function() {
options.offset = 10; options.offset = 10;
return this.User.count(options).then(function() { return this.User.count(options).then(function() {
var optsArg = aggregateSpy.args[0][2]; expect(aggregateSpy).to.have.been.calledWith(
sinon.match.any, sinon.match.any,
expect(optsArg.offset).to.equal(null); sinon.match.object.and(sinon.match.has('offset', null)));
}); });
}); });
...@@ -1707,9 +1707,9 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -1707,9 +1707,9 @@ describe(Support.getTestDialectTeaser('Model'), function() {
options.order = "username"; options.order = "username";
return this.User.count(options).then(function() { return this.User.count(options).then(function() {
var optsArg = aggregateSpy.args[0][2]; expect(aggregateSpy).to.have.been.calledWith(
sinon.match.any, sinon.match.any,
expect(optsArg.order).to.equal(null); 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!