2011-03-01 12:59:54 +08:00
|
|
|
var helper = require(__dirname + "/../test-helper");
|
|
|
|
var Client = require(__dirname + "/../../lib/native").Client;
|
|
|
|
var conString = helper.connectionString();
|
|
|
|
|
|
|
|
test('fires callback with results', function() {
|
|
|
|
var client = new Client(conString);
|
2011-03-02 03:51:25 +08:00
|
|
|
client.connect();
|
|
|
|
client.query('SELECT 1 as num', assert.calls(function(err, result) {
|
|
|
|
assert.isNull(err);
|
|
|
|
assert.equal(result.rows[0].num, 1);
|
|
|
|
client.query('SELECT * FROM person WHERE name = $1', ['Brian'], assert.calls(function(err, result) {
|
|
|
|
assert.isNull(err);
|
|
|
|
assert.equal(result.rows[0].name, 'Brian');
|
|
|
|
client.end();
|
|
|
|
}))
|
2011-03-01 12:59:54 +08:00
|
|
|
}));
|
|
|
|
})
|