node-postgres/test/native/callback-api-tests.js
Alexander Sulfrian f698ed4459 use config dict in all test
instead of the connection string use the config dict in all tests to
be able to specify things like binary mode
2011-11-22 05:00:54 +01:00

17 lines
575 B
JavaScript

var helper = require(__dirname + "/../test-helper");
var Client = require(__dirname + "/../../lib/native");
test('fires callback with results', function() {
var client = new Client(helper.config);
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();
}))
}));
})