diff --git a/lib/pool-factory.js b/lib/pool-factory.js index aa7bd0b..85f0e6a 100644 --- a/lib/pool-factory.js +++ b/lib/pool-factory.js @@ -3,7 +3,6 @@ var util = require('util'); var Pool = require('pg-pool'); module.exports = function(Client) { - var BoundPool = function(options) { var config = { Client: Client }; for (var key in options) { diff --git a/test/integration/connection-pool/double-connection-tests.js b/test/integration/connection-pool/double-connection-tests.js index ae7eb31..421e1f9 100644 --- a/test/integration/connection-pool/double-connection-tests.js +++ b/test/integration/connection-pool/double-connection-tests.js @@ -1,2 +1,2 @@ -var helper = require(__dirname + "/test-helper") +var helper = require("./test-helper") helper.testPoolSize(2); diff --git a/test/integration/connection-pool/ending-empty-pool-tests.js b/test/integration/connection-pool/ending-empty-pool-tests.js index 4f5dd80..d1acc6f 100644 --- a/test/integration/connection-pool/ending-empty-pool-tests.js +++ b/test/integration/connection-pool/ending-empty-pool-tests.js @@ -1,4 +1,4 @@ -var helper = require(__dirname + '/test-helper') +var helper = require('./test-helper') var called = false; test('disconnects', function() { diff --git a/test/integration/connection-pool/ending-pool-tests.js b/test/integration/connection-pool/ending-pool-tests.js index 83f4b1b..3a1ab46 100644 --- a/test/integration/connection-pool/ending-pool-tests.js +++ b/test/integration/connection-pool/ending-pool-tests.js @@ -1,6 +1,7 @@ -var helper = require(__dirname + '/test-helper') +var helper = require('./test-helper') var called = false; + test('disconnects', function() { var sink = new helper.Sink(4, function() { called = true; diff --git a/test/integration/connection-pool/error-tests.js b/test/integration/connection-pool/error-tests.js index 2cf0501..59121a8 100644 --- a/test/integration/connection-pool/error-tests.js +++ b/test/integration/connection-pool/error-tests.js @@ -1,5 +1,5 @@ -var helper = require(__dirname + "/../test-helper"); -var pg = require(__dirname + "/../../../lib"); +var helper = require("../test-helper"); +var pg = require("../../../lib"); //first make pool hold 2 clients pg.defaults.poolSize = 2; diff --git a/test/integration/connection-pool/idle-timeout-tests.js b/test/integration/connection-pool/idle-timeout-tests.js index 0a60ce5..b0908b6 100644 --- a/test/integration/connection-pool/idle-timeout-tests.js +++ b/test/integration/connection-pool/idle-timeout-tests.js @@ -1,4 +1,4 @@ -var helper = require(__dirname + '/test-helper'); +var helper = require('./test-helper'); var _ = require('lodash') const config = _.extend({ }, helper.config, { idleTimeoutMillis: 50 }) diff --git a/test/integration/connection-pool/max-connection-tests.js b/test/integration/connection-pool/max-connection-tests.js index 68c0773..944d2fb 100644 --- a/test/integration/connection-pool/max-connection-tests.js +++ b/test/integration/connection-pool/max-connection-tests.js @@ -1,2 +1,2 @@ -var helper = require(__dirname + "/test-helper") +var helper = require("./test-helper") helper.testPoolSize(40); diff --git a/test/integration/connection-pool/native-instance-tests.js b/test/integration/connection-pool/native-instance-tests.js index 06fbdb4..314920c 100644 --- a/test/integration/connection-pool/native-instance-tests.js +++ b/test/integration/connection-pool/native-instance-tests.js @@ -1,4 +1,4 @@ -var helper = require(__dirname + "/../test-helper") +var helper = require("./../test-helper") var pg = helper.pg var native = helper.args.native diff --git a/test/integration/connection-pool/optional-config-tests.js b/test/integration/connection-pool/optional-config-tests.js index f0ba2e7..be7063e 100644 --- a/test/integration/connection-pool/optional-config-tests.js +++ b/test/integration/connection-pool/optional-config-tests.js @@ -1,4 +1,4 @@ -var helper = require(__dirname + '/test-helper'); +var helper = require('./test-helper'); //setup defaults helper.pg.defaults.user = helper.args.user; diff --git a/test/integration/connection-pool/single-connection-tests.js b/test/integration/connection-pool/single-connection-tests.js index 5ca0a88..89f6f06 100644 --- a/test/integration/connection-pool/single-connection-tests.js +++ b/test/integration/connection-pool/single-connection-tests.js @@ -1,2 +1,2 @@ -var helper = require(__dirname + "/test-helper") +var helper = require("./test-helper") helper.testPoolSize(1); diff --git a/test/integration/connection-pool/single-pool-on-object-config-tests.js b/test/integration/connection-pool/single-pool-on-object-config-tests.js index a28cbf5..81cdf8e 100644 --- a/test/integration/connection-pool/single-pool-on-object-config-tests.js +++ b/test/integration/connection-pool/single-pool-on-object-config-tests.js @@ -1,5 +1,5 @@ -var helper = require(__dirname + "/../test-helper"); -var pg = require(__dirname + "/../../../lib"); +var helper = require("../test-helper"); +var pg = require("../../../lib"); pg.connect(helper.config, assert.success(function(client, done) { assert.equal(Object.keys(pg._pools).length, 1); diff --git a/test/integration/connection-pool/waiting-connection-tests.js b/test/integration/connection-pool/waiting-connection-tests.js index f2519ec..82572d1 100644 --- a/test/integration/connection-pool/waiting-connection-tests.js +++ b/test/integration/connection-pool/waiting-connection-tests.js @@ -1,2 +1,2 @@ -var helper = require(__dirname + "/test-helper") +var helper = require("./test-helper") helper.testPoolSize(200); diff --git a/test/unit/client/configuration-tests.js b/test/unit/client/configuration-tests.js index 0204af2..5548e5f 100644 --- a/test/unit/client/configuration-tests.js +++ b/test/unit/client/configuration-tests.js @@ -59,6 +59,17 @@ test('client settings', function() { test('initializing from a config string', function() { + test('uses connectionString property', function () { + var client = new Client({ + connectionString: 'postgres://brian:pass@host1:333/databasename' + }) + assert.equal(client.user, 'brian'); + assert.equal(client.password, "pass"); + assert.equal(client.host, "host1"); + assert.equal(client.port, 333); + assert.equal(client.database, "databasename"); + }) + test('uses the correct values from the config string', function() { var client = new Client("postgres://brian:pass@host1:333/databasename") assert.equal(client.user, 'brian'); diff --git a/test/unit/client/connection-string-tests.js b/test/unit/client/connection-string-tests.js deleted file mode 100644 index 9316daa..0000000 --- a/test/unit/client/connection-string-tests.js +++ /dev/null @@ -1,27 +0,0 @@ -require(__dirname + '/test-helper'); - -/* - * Perhaps duplicate of test named 'initializing from a config string' in - * configuration-tests.js - */ - -test("using connection string in client constructor", function() { - var client = new Client("postgres://brian:pw@boom:381/lala"); - - test("parses user", function() { - assert.equal(client.user,'brian'); - }); - test("parses password", function() { - assert.equal(client.password, 'pw'); - }); - test("parses host", function() { - assert.equal(client.host, 'boom'); - }); - test('parses port', function() { - assert.equal(client.port, 381) - }); - test('parses database', function() { - assert.equal(client.database, 'lala') - }); -}); -