Skip to content

Commit

Permalink
Continue support for creating a pg.Pool from another instance’s optio…
Browse files Browse the repository at this point in the history
…ns (#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.
  • Loading branch information
charmander authored and brianc committed Jan 28, 2020
1 parent 224703f commit 05c7665
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 1 addition & 2 deletions packages/pg/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions packages/pg/test/unit/connection-pool/configuration-tests.js
Original file line number Diff line number Diff line change
@@ -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')
})

0 comments on commit 05c7665

Please sign in to comment.