Skip to content

Commit ef0b428

Browse files
committed
test: clarify pool.end() test expectation
1 parent 32e44aa commit ef0b428

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/postgres-bridge/bridge.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ for (const {
120120
await connection2.end();
121121
});
122122

123-
test(clientName + ': pool.end() destroys all connections', async (t) => {
123+
test(clientName + ': pool.end() immediately resolves if all connections are released', async (t) => {
124124
const pool = new Pool({
125125
user: 'postgres',
126126
});
@@ -135,8 +135,15 @@ for (const {
135135
await connection1.release();
136136
await connection2.release();
137137

138+
const startTime = Date.now();
139+
138140
await pool.end();
139141

142+
const duration = Date.now() - startTime;
143+
144+
// If duration is longer than a couple milliseconds then something is off.
145+
t.true(duration < 10);
146+
140147
t.is(pool.totalCount, 0);
141148
});
142149

0 commit comments

Comments
 (0)