mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
22 lines
548 B
JavaScript
22 lines
548 B
JavaScript
var helper = require(__dirname + "/../test-helper");
|
|
var Connection = require(__dirname + "/../../lib/binding");
|
|
|
|
test('calling connect without params raises error', function() {
|
|
var con = new Connection();
|
|
var err;
|
|
try{
|
|
con.connect();
|
|
} catch (e) {
|
|
err = e;
|
|
}
|
|
assert.ok(err!=null);
|
|
});
|
|
|
|
test('connects', function() {
|
|
var con = new Connection();
|
|
con.connect("user=postgres password=1234 hostaddr=127.0.0.1 port=5432 dbname=postgres");
|
|
assert.emits(con, 'connect', function() {
|
|
con._sendQuery("SELECT NOW()");
|
|
});
|
|
})
|