MCPcopy Create free account
hub / github.com/denodrivers/postgres / generatePoolClientTest

Function generatePoolClientTest

tests/helpers.ts:23–44  ·  view source on GitHub ↗
(client_options: ClientOptions)

Source from the content-addressed store, hash-verified

21}
22
23export function generatePoolClientTest(client_options: ClientOptions) {
24 return function generatePoolClientTest1(
25 test_function: (pool: Pool, size: number, lazy: boolean) => Promise<void>,
26 size = 10,
27 lazy = false,
28 ) {
29 return async () => {
30 const pool = new Pool(client_options, size, lazy);
31 // If the connection is not lazy, create a client to await
32 // for initialization
33 if (!lazy) {
34 const client = await pool.connect();
35 client.release();
36 }
37 try {
38 await test_function(pool, size, lazy);
39 } finally {
40 await pool.end();
41 }
42 };
43 };
44}

Callers 1

pool_test.tsFile · 0.90

Calls 3

connectMethod · 0.95
endMethod · 0.95
releaseMethod · 0.45

Tested by

no test coverage detected