Brian C aeb0c759f5 Remove fallbacks for unsupported Node versions (#1304) (#1313)
* Add client connectionString tests (#1310)

* Remove redundant tests

* Add client connectionString test

Add test to ensure { connectionString } is respected as an argument to the client constructor

* Add test for connection string property

Also fixed some legacy require statements.

* Normalize native error properties

Map native error properties to the same property names we use for errors from the JS driver.

Fixes #972
Fixes #938
2017-06-08 21:53:47 -05:00

31 lines
801 B
JavaScript

var helper = require('./test-helper')
var called = false;
test('disconnects', function() {
var sink = new helper.Sink(4, function() {
called = true;
var eventSink = new helper.Sink(1, function() {});
helper.pg.on('end', function() {
eventSink.add();
});
//this should exit the process, killing each connection pool
helper.pg.end();
});
[helper.config, helper.config, helper.config, helper.config].forEach(function(config) {
helper.pg.connect(config, function(err, client, done) {
assert.isNull(err);
client.query("SELECT * FROM NOW()", function(err, result) {
setTimeout(function() {
assert.equal(called, false, "Should not have disconnected yet")
sink.add();
done();
}, 0)
})
})
})
})