replication.test.js
1.12 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
39
40
41
42
43
44
'use strict';
/* jshint -W030 */
/* jshint -W110 */
var chai = require('chai')
, expect = chai.expect
, Support = require(__dirname + '/support')
, DataTypes = require(__dirname + '/../../lib/data-types')
, dialect = Support.getTestDialect();
describe(Support.getTestDialectTeaser('Replication'), function() {
if (dialect === 'sqlite') return;
beforeEach(function () {
this.sequelize = Support.getSequelizeInstance(null, null, null, {
replication: {
write: Support.getConnectionOptions(),
read: [Support.getConnectionOptions()]
}
});
expect(this.sequelize.connectionManager.pool.write).to.be.ok;
expect(this.sequelize.connectionManager.pool.read).to.be.ok;
this.User = this.sequelize.define('User', {
firstName: {
type: DataTypes.STRING,
field: 'first_name'
}
});
return this.User.sync({force: true});
});
it('should be able to make a write', function () {
return this.User.create({
firstName: Math.random().toString()
});
});
it('should be able to make a read', function () {
return this.User.findAll();
});
});