Skip to content

Commit 9c4e160

Browse files
author
Sandro Santilli
committed
Add failing test for accessing result fields info (brianc#209)
1 parent a029e65 commit 9c4e160

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/integration/client/api-tests.js

+16
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,19 @@ test('null and undefined are both inserted as NULL', function() {
156156
}))
157157
}))
158158
})
159+
160+
test('provides field names and types to the callback', function() {
161+
pg.connect(helper.config, assert.calls(function(err, client) {
162+
assert.isNull(err);
163+
var config = {
164+
text: 'select $1::text as val limit 0'
165+
};
166+
client.query(config, ['hi'], assert.calls(function(err, result) {
167+
assert.isNull(err);
168+
assert.equal(result.fields.length, 1);
169+
assert.equal(result.fields[0].name, 'val');
170+
assert.equal(result.fields[0].type, 'text');
171+
}))
172+
}))
173+
})
174+

0 commit comments

Comments
 (0)