Skip to content

Commit 45d62d0

Browse files
committed
Add test for pool.end method
1 parent 33e0f16 commit 45d62d0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/pg-pool/test/ending.js

+10
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,14 @@ describe('pool ending', () => {
3737
expect(res.rows[0].name).to.equal('brianc')
3838
})
3939
)
40+
41+
it('pool.end() - finish pending queries', async () => {
42+
const pool = new Pool({ max: 20 })
43+
let completed = 0
44+
for (let x = 1; x <= 20; x++) {
45+
pool.query('SELECT $1::text as name', ['brianc']).then(() => completed++)
46+
}
47+
await pool.end()
48+
expect(completed).to.equal(20)
49+
})
4050
})

0 commit comments

Comments
 (0)