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

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 () {
})
describe('complex long running example', function() {
it("works", function(done) {
var sequelize = this.sequelize
var Test = sequelize.define('Test', {
id: { type: Support.Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
name: { type: Support.Sequelize.STRING }
})
it("works with promise syntax", function(done) {
Support.prepareTransactionTest(this.sequelize, function(sequelize) {
var Test = sequelize.define('Test', {
id: { type: Support.Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
name: { type: Support.Sequelize.STRING }
})
sequelize
.sync({ force: true })
.then(function() {
sequelize.transaction(function(transaction) {
Test
.create({ name: 'Peter' }, { transaction: transaction })
.then(function() {
setTimeout(function() {
transaction
.commit()
.then(function() {
return Test.count({ transaction: transaction })
})
.then(function(count) {
expect(count).to.equal(1)
done()
})
}, 1000)
})
sequelize
.sync({ force: true })
.then(function() {
sequelize.transaction(function(transaction) {
Test
.create({ name: 'Peter' }, { transaction: transaction })
.then(function() {
setTimeout(function() {
transaction
.commit()
.then(function() { return Test.count() })
.then(function(count) {
expect(count).to.equal(1)
done()
})
}, 1000)
})
})
})
})
})
})
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!