MCPcopy
hub / github.com/sequelize/sequelize / simulateUnexpectedError

Function simulateUnexpectedError

test/integration/pool.test.js:91–101  ·  view source on GitHub ↗
(connection)

Source from the content-addressed store, hash-verified

89 describe('network / connection errors', () => {
90 it('should obtain new connection when old connection is abruptly closed', async () => {
91 function simulateUnexpectedError(connection) {
92 // should never be returned again
93 if (dialect === 'mssql') {
94 connection = attachMSSQLUniqueId(connection);
95 }
96 if (dialect === 'db2') {
97 sequelize.connectionManager.pool.destroy(connection);
98 } else {
99 connection.emit('error', { code: 'ECONNRESET' });
100 }
101 }
102
103 const sequelize = Support.createSequelizeInstance({
104 pool: { max: 1, idle: 5000 }

Callers 1

pool.test.jsFile · 0.85

Calls 3

attachMSSQLUniqueIdFunction · 0.85
destroyMethod · 0.80
closeMethod · 0.65

Tested by

no test coverage detected