node-postgres/test/unit/client/connection-string-tests.js
Gurjeet Singh 6530ce27fe Miscellaneous improvements in unit tests.
End statements with semicolons, to be consistent with the surrounding
code.

Added a new unit test to ensure environment variables are honored when
parsing a
connection string.

Added a TODO to cleanup a test that emits messages using console.log().

Correct a query's syntax. Looks like a good thing to do even though the
syntax
doesn't matter in mocked out tests.

Removed a test that tests for SELECT tags; AFAIK, SELECT commands don't
emit a
tag.
2014-06-15 17:33:23 -04:00

28 lines
692 B
JavaScript

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