node-postgres/test/integration/connection-pool/single-pool-on-object-config-tests.js
Raul Ochoa 4cd56cc4f8 Make pool name consistent on missing config params (#1279)
* Going red: using a config object creates two pools when missing some params

It should only create a pool in a consistent way, even if some params
are not provided in the first place.

* Delay the pool name generation to make it consistent between calls

* Don't fallback to empty object as config is already defined
2017-05-24 09:04:50 -05:00

14 lines
405 B
JavaScript

var helper = require(__dirname + "/../test-helper");
var pg = require(__dirname + "/../../../lib");
pg.connect(helper.config, assert.success(function(client, done) {
assert.equal(Object.keys(pg._pools).length, 1);
pg.connect(helper.config, assert.success(function(client2, done2) {
assert.equal(Object.keys(pg._pools).length, 1);
done();
done2();
pg.end();
}));
}));