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

Commit 3e3e208a by Mick Hansen

fix jshint

1 parent 615b74a4
Showing with 5 additions and 4 deletions
...@@ -6,7 +6,6 @@ var chai = require('chai') ...@@ -6,7 +6,6 @@ var chai = require('chai')
, Support = require(__dirname + '/../support') , Support = require(__dirname + '/../support')
, UniqueConstraintError = require(__dirname + '/../../../lib/errors').UniqueConstraintError , UniqueConstraintError = require(__dirname + '/../../../lib/errors').UniqueConstraintError
, current = Support.sequelize , current = Support.sequelize
, cls = require('continuation-local-storage')
, sinon = require('sinon') , sinon = require('sinon')
, Promise = require('bluebird'); , Promise = require('bluebird');
...@@ -38,9 +37,10 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -38,9 +37,10 @@ describe(Support.getTestDialectTeaser('Model'), function() {
it('should create if first find call is empty', function () { it('should create if first find call is empty', function () {
var result = {} var result = {}
, where = {prop: Math.random().toString()} , where = {prop: Math.random().toString()}
, findSpy = this.sinon.stub(Model, 'findOne').returns(Promise.resolve(null))
, createSpy = this.sinon.stub(Model, 'create').returns(Promise.resolve(result)); , createSpy = this.sinon.stub(Model, 'create').returns(Promise.resolve(result));
this.sinon.stub(Model, 'findOne').returns(Promise.resolve(null));
return expect(Model.findCreateFind({ return expect(Model.findCreateFind({
where: where where: where
})).to.eventually.eql([result, true]).then(function () { })).to.eventually.eql([result, true]).then(function () {
...@@ -51,8 +51,9 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -51,8 +51,9 @@ describe(Support.getTestDialectTeaser('Model'), function() {
it('should do a second find if create failed do to unique constraint', function () { it('should do a second find if create failed do to unique constraint', function () {
var result = {} var result = {}
, where = {prop: Math.random().toString()} , where = {prop: Math.random().toString()}
, findSpy = this.sinon.stub(Model, 'findOne') , findSpy = this.sinon.stub(Model, 'findOne');
, createSpy = this.sinon.stub(Model, 'create').returns(Promise.reject(new UniqueConstraintError()));
this.sinon.stub(Model, 'create').returns(Promise.reject(new UniqueConstraintError()));
findSpy.onFirstCall().returns(Promise.resolve(null)); findSpy.onFirstCall().returns(Promise.resolve(null));
findSpy.onSecondCall().returns(Promise.resolve(result)); findSpy.onSecondCall().returns(Promise.resolve(result));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!