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

Commit 46313bc1 by Sascha Depold

Wrap the test within prepareTransactionTest

1 parent 4ebe4bcc
Showing with 25 additions and 27 deletions
...@@ -118,35 +118,33 @@ describe(Support.getTestDialectTeaser("Sequelize#transaction"), function () { ...@@ -118,35 +118,33 @@ describe(Support.getTestDialectTeaser("Sequelize#transaction"), function () {
}) })
describe('complex long running example', function() { describe('complex long running example', function() {
it("works", function(done) { it("works with promise syntax", function(done) {
var sequelize = this.sequelize Support.prepareTransactionTest(this.sequelize, function(sequelize) {
var Test = sequelize.define('Test', {
var Test = sequelize.define('Test', { id: { type: Support.Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
id: { type: Support.Sequelize.INTEGER, primaryKey: true, autoIncrement: true}, name: { type: Support.Sequelize.STRING }
name: { type: Support.Sequelize.STRING } })
})
sequelize sequelize
.sync({ force: true }) .sync({ force: true })
.then(function() { .then(function() {
sequelize.transaction(function(transaction) { sequelize.transaction(function(transaction) {
Test Test
.create({ name: 'Peter' }, { transaction: transaction }) .create({ name: 'Peter' }, { transaction: transaction })
.then(function() { .then(function() {
setTimeout(function() { setTimeout(function() {
transaction transaction
.commit() .commit()
.then(function() { .then(function() { return Test.count() })
return Test.count({ transaction: transaction }) .then(function(count) {
}) expect(count).to.equal(1)
.then(function(count) { done()
expect(count).to.equal(1) })
done() }, 1000)
}) })
}, 1000) })
})
}) })
}) })
}) })
}) })
}) })
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!