Skip to content

Commit cda667d

Browse files
committed
tests for PGRES_COMMAND_OKAY and multiple rows
1 parent 1ee427a commit cda667d

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

test/native/evented-api-tests.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
var helper = require(__dirname + "/../test-helper");
22
var Client = require(__dirname + "/../../lib/native").Client;
3-
3+
var conString = "tcp://postgres:1234@127.0.0.1:5432/postgres";
44
test('connects', function() {
5-
var client = new Client("tcp://postgres:1234@127.0.0.1:5432/postgres");
5+
var client = new Client(conString);
66
client.connect();
77
test('good query', function() {
88
var query = client.query("SELECT 1 as num, 'HELLO' as str");
@@ -25,6 +25,22 @@ test('connects', function() {
2525
})
2626
})
2727
})
28-
2928
})
3029

30+
test('multiple results', function() {
31+
var client = new Client(conString);
32+
client.connect();
33+
test('queued queries', function() {
34+
client.query("CREATE TEMP TABLE boom(name varchar(10))");
35+
client.query("INSERT INTO boom(name) VALUES('Aaron')");
36+
client.query("INSERT INTO boom(name) VALUES('Brian')");
37+
var q = client.query("SELECT * from BOOM");
38+
assert.emits(q, 'row', function(row) {
39+
assert.equal(row.name, 'Aaron');
40+
assert.emits(q, 'row', function(row) {
41+
assert.equal(row.name, "Brian");
42+
client.end();
43+
})
44+
})
45+
})
46+
})

0 commit comments

Comments
 (0)