Skip to content

Commit

Permalink
fix: test resolve should be called when the last client is removed
Browse files Browse the repository at this point in the history
  • Loading branch information
asadbek2021 committed Jun 17, 2024
1 parent 293cfa8 commit e81fc3d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/pg-pool/test/idle-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('idle timeout', () => {
it(
'times out and removes clients when others are also removed',
co.wrap(function* () {
let currentClient = 1
const pool = new Pool({ idleTimeoutMillis: 10 })
const clientA = yield pool.connect()
const clientB = yield pool.connect()
Expand All @@ -35,7 +36,12 @@ describe('idle timeout', () => {
pool.on('remove', () => {
expect(pool.idleCount).to.equal(0)
expect(pool.totalCount).to.equal(0)
resolve()

if (currentClient >= 2) {
resolve()
} else {
currentClient++
}
})
})

Expand Down

0 comments on commit e81fc3d

Please sign in to comment.