mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
Add failing test for result rows as arrays
This commit is contained in:
parent
5462561e51
commit
325a6d9153
28
test/integration/client/results-as-array-tests.js
Normal file
28
test/integration/client/results-as-array-tests.js
Normal file
@ -0,0 +1,28 @@
|
||||
var util = require('util');
|
||||
var helper = require('./test-helper');
|
||||
|
||||
var Client = helper.Client;
|
||||
|
||||
var conInfo = helper.config;
|
||||
|
||||
test('returns results as array', function() {
|
||||
var client = new Client(conInfo);
|
||||
var checkRow = function(row) {
|
||||
assert(util.isArray(row), 'row should be an array');
|
||||
}
|
||||
client.connect(assert.success(function() {
|
||||
var config = {
|
||||
text: 'SELECT NOW(), 1::int, $1::text',
|
||||
values: ['hai'],
|
||||
rowMode: 'array'
|
||||
};
|
||||
var query = client.query(config, assert.success(function(result) {
|
||||
assert.equal(result.rows.length, 1);
|
||||
checkRow(result.rows[0]);
|
||||
client.end();
|
||||
}));
|
||||
assert.emits(query, 'row', function(row) {
|
||||
checkRow(row);
|
||||
});
|
||||
}));
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user