Add tests for issues fixed in #3428 (#3432)

This commit is contained in:
Brian C 2025-04-23 11:53:54 -05:00 committed by GitHub
parent 2da196cc1f
commit e8280d58f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,24 @@
const assert = require('node:assert')
const test = require('node:test')
const { describe, it } = test
const paths = ['pg', 'pg/lib/index.js', 'pg/lib/connection-parameters.js']
for (const path of paths) {
describe(`importing ${path}`, () => {
it('works with require', () => {
const mod = require(path)
assert(mod)
})
})
}
describe('pg-native', () => {
it('should work with commonjs', async () => {
const pg = require('pg')
const pool = new pg.native.Pool()
const result = await pool.query('SELECT 1')
assert.strictEqual(result.rowCount, 1)
pool.end()
})
})