Skip to content

Commit ac438e8

Browse files
committed
Add integration test for Result.addRow
1 parent 99a0dce commit ac438e8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/integration/client/simple-query-tests.js

+21
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,27 @@ test("simple query interface", function() {
3636
});
3737
});
3838

39+
test("simple query interface using addRow", function() {
40+
41+
var client = helper.client();
42+
43+
var query = client.query("select name from person order by name");
44+
45+
client.on('drain', client.end.bind(client));
46+
47+
query.on('row', function(row, result) {
48+
assert.ok(result);
49+
result.addRow(row);
50+
});
51+
52+
query.on('end', function(result) {
53+
assert.lengthIs(result.rows, 26, "result returned wrong number of rows");
54+
assert.lengthIs(result.rows, result.rowCount);
55+
assert.equal(result.rows[0].name, "Aaron");
56+
assert.equal(result.rows[25].name, "Zanzabar");
57+
});
58+
});
59+
3960
test("multiple simple queries", function() {
4061
var client = helper.client();
4162
client.query({ text: "create temp table bang(id serial, name varchar(5));insert into bang(name) VALUES('boom');"})

0 commit comments

Comments
 (0)