Skip to content

Commit

Permalink
Add test for pool.end method
Browse files Browse the repository at this point in the history
  • Loading branch information
asadbek2021 committed Jun 11, 2024
1 parent 33e0f16 commit 45d62d0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/pg-pool/test/ending.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,14 @@ describe('pool ending', () => {
expect(res.rows[0].name).to.equal('brianc')
})
)

it('pool.end() - finish pending queries', async () => {
const pool = new Pool({ max: 20 })
let completed = 0
for (let x = 1; x <= 20; x++) {
pool.query('SELECT $1::text as name', ['brianc']).then(() => completed++)
}
await pool.end()
expect(completed).to.equal(20)
})
})

0 comments on commit 45d62d0

Please sign in to comment.