Skip to content

Commit 05c7665

Browse files
charmanderbrianc
authored andcommitted
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.
1 parent 224703f commit 05c7665

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

Diff for: packages/pg/lib/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ var Pool = require('pg-pool')
1515
const poolFactory = (Client) => {
1616
return class BoundPool extends Pool {
1717
constructor (options) {
18-
var config = Object.assign({ Client: Client }, options)
19-
super(config)
18+
super(options, Client)
2019
}
2120
}
2221
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict'
2+
3+
const assert = require('assert')
4+
const helper = require('../test-helper')
5+
6+
test('pool with copied settings includes password', () => {
7+
const original = new helper.pg.Pool({
8+
password: 'original',
9+
})
10+
11+
const copy = new helper.pg.Pool(original.options)
12+
13+
assert.equal(copy.options.password, 'original')
14+
})

0 commit comments

Comments
 (0)