Skip to content

Commit 5b0baf7

Browse files
committed
Add tests for issues fixed in #3428
1 parent 2da196c commit 5b0baf7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const assert = require('node:assert')
2+
const test = require('node:test')
3+
const { describe, it } = test
4+
5+
const paths = ['pg', 'pg/lib/index.js', 'pg/lib/connection-parameters.js']
6+
for (const path of paths) {
7+
describe(`importing ${path}`, () => {
8+
it('works with require', () => {
9+
const mod = require(path)
10+
assert(mod)
11+
})
12+
})
13+
}
14+
15+
describe('pg-native', () => {
16+
it('should work with commonjs', async () => {
17+
const pg = require('pg')
18+
19+
const pool = new pg.native.Pool()
20+
const result = await pool.query('SELECT 1')
21+
assert.strictEqual(result.rowCount, 1)
22+
pool.end()
23+
})
24+
})

0 commit comments

Comments
 (0)