tests for PGRES_COMMAND_OKAY and multiple rows

This commit is contained in:
Brian Carlson 2011-02-23 20:13:22 -06:00
parent 1ee427ac4f
commit cda667df24

View File

@ -1,8 +1,8 @@
var helper = require(__dirname + "/../test-helper");
var Client = require(__dirname + "/../../lib/native").Client;
var conString = "tcp://postgres:1234@127.0.0.1:5432/postgres";
test('connects', function() {
var client = new Client("tcp://postgres:1234@127.0.0.1:5432/postgres");
var client = new Client(conString);
client.connect();
test('good query', function() {
var query = client.query("SELECT 1 as num, 'HELLO' as str");
@ -25,6 +25,22 @@ test('connects', function() {
})
})
})
})
test('multiple results', function() {
var client = new Client(conString);
client.connect();
test('queued queries', function() {
client.query("CREATE TEMP TABLE boom(name varchar(10))");
client.query("INSERT INTO boom(name) VALUES('Aaron')");
client.query("INSERT INTO boom(name) VALUES('Brian')");
var q = client.query("SELECT * from BOOM");
assert.emits(q, 'row', function(row) {
assert.equal(row.name, 'Aaron');
assert.emits(q, 'row', function(row) {
assert.equal(row.name, "Brian");
client.end();
})
})
})
})