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

Commit 1133077c by Daniel Durante

Fixed some async issues with mocha tests.

1 parent 7e565cd7
...@@ -9,11 +9,6 @@ chai.Assertion.includeStack = true ...@@ -9,11 +9,6 @@ chai.Assertion.includeStack = true
if (dialect.match(/^postgres/)) { if (dialect.match(/^postgres/)) {
describe('[POSTGRES Specific] associations', function() { describe('[POSTGRES Specific] associations', function() {
beforeEach(function(done) {
this.sequelize.options.quoteIdentifier = true
done()
})
describe('many-to-many', function() { describe('many-to-many', function() {
describe('where tables have the same prefix', function() { describe('where tables have the same prefix', function() {
it("should create a table wp_table1wp_table2s", function(done) { it("should create a table wp_table1wp_table2s", function(done) {
...@@ -76,17 +71,15 @@ if (dialect.match(/^postgres/)) { ...@@ -76,17 +71,15 @@ if (dialect.match(/^postgres/)) {
tasks[tasks.length] = {name: 'Task' + Math.random()} tasks[tasks.length] = {name: 'Task' + Math.random()}
} }
self.sequelize.getQueryInterface().dropAllTables().success(function() { self.User.sync({ force: true }).success(function() {
self.User.sync({ force: true }).success(function() { self.Task.sync({ force: true }).success(function() {
self.Task.sync({ force: true }).success(function() { self.User.bulkCreate(users).success(function() {
self.User.bulkCreate(users).success(function() { self.Task.bulkCreate(tasks).success(function() {
self.Task.bulkCreate(tasks).success(function() { self.User.all().success(function(_users) {
self.User.all().success(function(_users) { self.Task.all().success(function(_tasks) {
self.Task.all().success(function(_tasks) { self.user = _users[0]
self.user = _users[0] self.task = _tasks[0]
self.task = _tasks[0] done()
done()
})
}) })
}) })
}) })
......
...@@ -48,7 +48,7 @@ describe(Support.getTestDialectTeaser("QueryInterface"), function () { ...@@ -48,7 +48,7 @@ describe(Support.getTestDialectTeaser("QueryInterface"), function () {
}) })
describe('indexes', function() { describe('indexes', function() {
before(function(done) { beforeEach(function(done) {
var self = this var self = this
this.queryInterface.dropTable('Users').success(function() { this.queryInterface.dropTable('Users').success(function() {
self.queryInterface.createTable('Users', { self.queryInterface.createTable('Users', {
......
...@@ -121,7 +121,7 @@ before(function(done) { ...@@ -121,7 +121,7 @@ before(function(done) {
done() done()
}) })
afterEach(function(done) { beforeEach(function(done) {
Support.clearDatabase(this.sequelize, function() { Support.clearDatabase(this.sequelize, function() {
done() done()
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!