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

Function simulateUnexpectedError

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

Source from the content-addressed store, hash-verified

81 describe('network / connection errors', () => {
82 it('should obtain new connection when old connection is abruptly closed', async () => {
83 function simulateUnexpectedError(connection) {
84 // should never be returned again
85 if (dialect === 'mssql') {
86 connection = attachMSSQLUniqueId(connection);
87 }
88 if (dialect === 'db2') {
89 sequelize.connectionManager.pool.destroy(connection);
90 } else {
91 connection.emit('error', { code: 'ECONNRESET' });
92 }
93 }
94
95 const sequelize = Support.createSequelizeInstance({
96 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