Continue support for creating a pg.Pool from another instance’s options (#2076)

* Add failing test for creating a `BoundPool` from another instance’s settings

* Continue support for creating a pg.Pool from another instance’s options

by dropping the requirement for the `password` property to be enumerable.
This commit is contained in:
Charmander 2020-01-17 08:49:06 -08:00 committed by Brian C
parent e3a35e9dc5
commit 8c606ff50e
2 changed files with 15 additions and 2 deletions

View File

@ -15,8 +15,7 @@ var Pool = require('pg-pool')
const poolFactory = (Client) => {
return class BoundPool extends Pool {
constructor (options) {
var config = Object.assign({ Client: Client }, options)
super(config)
super(options, Client)
}
}
}

View File

@ -0,0 +1,14 @@
'use strict'
const assert = require('assert')
const helper = require('../test-helper')
test('pool with copied settings includes password', () => {
const original = new helper.pg.Pool({
password: 'original',
})
const copy = new helper.pg.Pool(original.options)
assert.equal(copy.options.password, 'original')
})