connector-manager.test.js
1.34 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
'use strict';
const chai = require('chai');
const expect = chai.expect;
const Support = require('../../support');
const dialect = Support.getTestDialect();
const DataTypes = require('../../../../lib/data-types');
if (dialect === 'mysql') {
describe('[MYSQL Specific] Connection Manager', () => {
it('-FOUND_ROWS can be suppressed to get back legacy behavior', async () => {
const sequelize = Support.createSequelizeInstance({ dialectOptions: { flags: '' } });
const User = sequelize.define('User', { username: DataTypes.STRING });
await User.sync({ force: true });
await User.create({ id: 1, username: 'jozef' });
const [affectedCount] = await User.update({ username: 'jozef' }, {
where: {
id: 1
}
});
// https://github.com/sequelize/sequelize/issues/7184
await affectedCount.should.equal(1);
});
it('should acquire a valid connection when keepDefaultTimezone is true', async () => {
const sequelize = Support.createSequelizeInstance({ keepDefaultTimezone: true, pool: { min: 1, max: 1, handleDisconnects: true, idle: 5000 } });
const cm = sequelize.connectionManager;
await sequelize.sync();
const connection = await cm.getConnection();
expect(cm.validate(connection)).to.be.ok;
await cm.releaseConnection(connection);
});
});
}