Skip to content

Commit 61f98d9

Browse files
committed
test commit
1 parent 8250af4 commit 61f98d9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import helper from "./helper";
2+
import QueryStream from "../src";
3+
import pg from "pg";
4+
5+
6+
describe("Pool Query-Stream", function() {
7+
8+
it('releases pool connection after end of query stream', async function() {
9+
const pool = new pg.Pool();
10+
// const client = await pool.connect();
11+
const query = new QueryStream('SELECT NOW()');
12+
const stream = pool.query(query);
13+
14+
query.on('end',async(res)=>{
15+
console.log('query stream ended');
16+
});
17+
18+
// bellow code raising error as stream .on is not a function
19+
console.log(await stream); // this never gets resolved;
20+
stream.on('end',async (res)=>{
21+
console.log(res);
22+
await pool.end();
23+
console.log('stream ended');
24+
await Promise.resolve();
25+
})
26+
27+
})
28+
29+
})

0 commit comments

Comments
 (0)