2010-09-29 12:18:46 +08:00
|
|
|
require(__dirname+"/test-helper");
|
|
|
|
|
|
|
|
//defaults
|
|
|
|
var client = new Client();
|
|
|
|
assert.equal(client.user, null);
|
|
|
|
assert.equal(client.database, null);
|
|
|
|
assert.equal(client.port, 5432);
|
|
|
|
|
2010-09-30 12:52:57 +08:00
|
|
|
var user = 'brian';
|
|
|
|
var database = 'hello';
|
|
|
|
|
2010-09-29 12:18:46 +08:00
|
|
|
var client = new Client({
|
2010-09-30 12:52:57 +08:00
|
|
|
user: 'briancarlson',
|
|
|
|
database: 'hello',
|
2010-09-29 12:18:46 +08:00
|
|
|
port: 321
|
|
|
|
});
|
|
|
|
|
2010-09-30 12:52:57 +08:00
|
|
|
assert.equal(client.user, 'briancarlson');
|
|
|
|
assert.equal(client.database, 'hello');
|
2010-09-29 12:18:46 +08:00
|
|
|
assert.equal(client.port, 321);
|
|
|
|
|
|
|
|
client.port = 5432;
|
|
|
|
client.connect(function() {
|
|
|
|
console.log('connected');
|
|
|
|
client.query('select count(*) from items',function(result) {
|
|
|
|
console.log('ran query');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|