mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
Merge pull request #545 from CartoDB/master-do-not-assume-pgport
Do not assume PGPORT env variable is unset during testing
This commit is contained in:
commit
f15a027e4e
@ -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() {
|
||||
@ -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)
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user