transaction.test.js
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var chai = require('chai')
, expect = chai.expect
, Support = require(__dirname + '/support')
, Transaction = require(__dirname + '/../lib/transaction')
describe(Support.getTestDialectTeaser("Transaction"), function () {
describe('constructor', function() {
it('stores options', function() {
var transaction = new Transaction(this.sequelize)
expect(transaction.options).to.be.an.instanceOf(Object)
})
it('generates an identifier', function() {
var transaction = new Transaction(this.sequelize)
expect(transaction.id).to.exist
})
})
describe('commit', function() {
it('is a commit message available', function() {
expect(Transaction).to.respondTo('commit')
})
})
describe('rollback', function() {
it('is a rollback message available', function() {
expect(Transaction).to.respondTo('rollback')
})
})
describe('done', function() {
it('gets called when the transaction gets commited', function(done) {
var transaction = new Transaction(this.sequelize)
transaction.done(done)
transaction.commit()
})
})
})