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

Commit f58a9a03 by overlookmotel

Tests return promises

1 parent ae64f89e
Showing with 4 additions and 7 deletions
...@@ -4391,26 +4391,23 @@ describe(Support.getTestDialectTeaser("Hooks"), function () { ...@@ -4391,26 +4391,23 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
}); });
describe('universal', function() { describe('universal', function() {
beforeEach(function(done) { beforeEach(function() {
this.sequelize.addHook('beforeFind', function(options) { this.sequelize.addHook('beforeFind', function(options) {
options.where.name = 'Chong'; options.where.name = 'Chong';
}); });
this.Person = this.sequelize.define('Person', {name: DataTypes.STRING}); this.Person = this.sequelize.define('Person', {name: DataTypes.STRING});
this.Person.sync({ force: true }).bind(this).then(function() { return this.Person.sync({ force: true }).bind(this).then(function() {
return this.Person.create({name: 'Cheech'}); return this.Person.create({name: 'Cheech'});
}).then(function() { }).then(function() {
return this.Person.create({name: 'Chong'}); return this.Person.create({name: 'Chong'});
}).then(function() {
done();
}); });
}); });
it('hooks run on all models', function(done) { it('hooks run on all models', function() {
this.Person.find({where: {name: 'Cheech'}}).then(function(person) { return this.Person.find({where: {name: 'Cheech'}}).then(function(person) {
expect(person.name).to.equal('Chong'); expect(person.name).to.equal('Chong');
done();
}); });
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!