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

Commit aaf87a93 by Holger

added a test for persistent transactions on memory resident sqlite databases

1 parent 1d8aff72
Showing with 35 additions and 0 deletions
...@@ -55,6 +55,41 @@ describe(Support.getTestDialectTeaser("Transaction"), function () { ...@@ -55,6 +55,41 @@ describe(Support.getTestDialectTeaser("Transaction"), function () {
}); });
}); });
if (dialect == 'sqlite'){
it('provides persistent transactions', function (done) {
var sequelize = new Support.Sequelize('database', 'username', 'password', {dialect: 'sqlite'});
var User = sequelize.define('user', {
username: Support.Sequelize.STRING,
awesome: Support.Sequelize.BOOLEAN
});
return sequelize.transaction()
.then(function(t) {
return sequelize.sync({transaction:t})
.then(function( ) {
return t;
});
})
.then(function(t) {
return User.create({}, {transaction:t})
.then(function( ) {
t.commit();
});
})
.then(function( ) {
return sequelize.transaction();
})
.then(function(t) {
return User.findAll({}, {transaction:t});
})
.then(function(users) {
return expect(users.length).to.equal(2);
})
.then(function(object) {
done();
});
});
}
if (dialect !== 'sqlite') { if (dialect !== 'sqlite') {
describe('row locking', function () { describe('row locking', function () {
this.timeout(10000); this.timeout(10000);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!