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

Commit 4c6c293c by Ruben Bridgewater

Hotfix and refactor more tests

1 parent 76d386e1
......@@ -10,25 +10,24 @@ chai.config.includeStack = true;
if (Support.dialectIsMySQL()) {
describe('[MYSQL Specific] Connector Manager', function() {
it('works correctly after being idle', function(done) {
it('works correctly after being idle', function() {
var User = this.sequelize.define('User', { username: DataTypes.STRING })
, spy = sinon.spy();
User.sync({force: true}).then(function() {
User.create({username: 'user1'}).then(function() {
User.count().then(function(count) {
return User.sync({force: true}).then(function() {
return User.create({username: 'user1'}).then(function() {
return User.count().then(function(count) {
expect(count).to.equal(1);
spy();
setTimeout(function() {
User.count().then(function(count) {
return this.sequelize.Promise.delay(1000).then(function() {
return User.count().then(function(count) {
expect(count).to.equal(1);
spy();
if (spy.calledTwice) {
done();
if (!spy.calledTwice) {
throw new Error('Spy was not called twice');
}
});
}, 1000);
});
});
});
});
......
......@@ -260,7 +260,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
, count = 0;
return this.User.bulkCreate([{username: 'jack'}, {username: 'jack'}]).then(function() {
return this.sequelize.Promise.map(permutations, function(perm) {
return self.sequelize.Promise.map(permutations, function(perm) {
return self.User.find(perm).then(function(user) {
expect(user).to.be.null;
count++;
......@@ -297,7 +297,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
self.Task = self.sequelize.define('Task', { title: Sequelize.STRING });
self.Worker = self.sequelize.define('Worker', { name: Sequelize.STRING });
return this.init = function(callback) {
this.init = function(callback) {
return self.sequelize.sync({ force: true }).then(function() {
return self.Worker.create({ name: 'worker' }).then(function(worker) {
return self.Task.create({ title: 'homework' }).then(function(task) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!