Skip to content

Commit 325a6d9

Browse files
committed
Add failing test for result rows as arrays
1 parent 5462561 commit 325a6d9

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
var util = require('util');
2+
var helper = require('./test-helper');
3+
4+
var Client = helper.Client;
5+
6+
var conInfo = helper.config;
7+
8+
test('returns results as array', function() {
9+
var client = new Client(conInfo);
10+
var checkRow = function(row) {
11+
assert(util.isArray(row), 'row should be an array');
12+
}
13+
client.connect(assert.success(function() {
14+
var config = {
15+
text: 'SELECT NOW(), 1::int, $1::text',
16+
values: ['hai'],
17+
rowMode: 'array'
18+
};
19+
var query = client.query(config, assert.success(function(result) {
20+
assert.equal(result.rows.length, 1);
21+
checkRow(result.rows[0]);
22+
client.end();
23+
}));
24+
assert.emits(query, 'row', function(row) {
25+
checkRow(row);
26+
});
27+
}));
28+
});

0 commit comments

Comments
 (0)