mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
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:
parent
e3a35e9dc5
commit
8c606ff50e
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
14
packages/pg/test/unit/connection-pool/configuration-tests.js
Normal file
14
packages/pg/test/unit/connection-pool/configuration-tests.js
Normal 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')
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user