Skip to content

Commit

Permalink
Do not assume PGPORT env variable is unset during testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro Santilli committed Mar 18, 2014
1 parent 128f9c0 commit 7f43512
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/unit/client/configuration-tests.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
require(__dirname+'/test-helper');

var pguser = process.env['PGUSER'] || process.env.USER;
var pgdatabase = process.env['PGDATABASE'] || process.env.USER;
var pgport = process.env['PGPORT'] || 5432;

test('client settings', function() {

test('defaults', function() {
var client = new Client();
assert.equal(client.user, process.env['PGUSER'] || process.env.USER);
assert.equal(client.database, process.env['PGDATABASE'] || process.env.USER);
assert.equal(client.port, 5432);
assert.equal(client.user, pguser);
assert.equal(client.database, pgdatabase);
assert.equal(client.port, pgport);
});

test('custom', function() {
Expand Down Expand Up @@ -69,7 +73,7 @@ test('calls connect correctly on connection', function() {
usedHost = host;
};
client.connect();
assert.equal(usedPort, "/tmp/.s.PGSQL.5432");
assert.equal(usedPort, "/tmp/.s.PGSQL." + pgport);
assert.strictEqual(usedHost, undefined)
})

0 comments on commit 7f43512

Please sign in to comment.