mirror of
https://github.com/brianc/node-postgres.git
synced 2026-02-01 16:47:23 +00:00
* Use class-extends to wrap Pool * Minimize diff * Test `BoundPool` inheritance Co-authored-by: Charmander <~@charmander.me> Co-authored-by: Brian C <brian.m.carlson@gmail.com>
26 lines
559 B
JavaScript
26 lines
559 B
JavaScript
|
|
"use strict"
|
|
const helper = require('./../test-helper')
|
|
const assert = require('assert')
|
|
|
|
const suite = new helper.Suite()
|
|
|
|
suite.testAsync('BoundPool can be subclassed', async () => {
|
|
const Pool = helper.pg.Pool;
|
|
class SubPool extends Pool {
|
|
|
|
}
|
|
const subPool = new SubPool()
|
|
const client = await subPool.connect()
|
|
client.release()
|
|
await subPool.end()
|
|
assert(subPool instanceof helper.pg.Pool)
|
|
})
|
|
|
|
suite.test('calling pg.Pool without new throws', () => {
|
|
const Pool = helper.pg.Pool;
|
|
assert.throws(() => {
|
|
const pool = Pool()
|
|
})
|
|
})
|