node-postgres/test/unit/client/connection-string-tests.js

28 lines
692 B
JavaScript
Raw Normal View History

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')
});
});