node-postgres/test/integration/client/no-datat-tests.js

36 lines
680 B
JavaScript
Raw Normal View History

var helper = require(__dirname + '/test-helper');
test("noData message handling", function() {
2010-10-30 09:16:05 +08:00
var client = helper.client();
client.query({
name: 'boom',
text: 'create temp table boom(id serial, size integer)'
});
client.query({
name: 'insert',
text: 'insert into boom(size) values($1)',
values: [100]
});
client.query({
name: 'insert',
values: [101]
});
2010-10-30 09:16:05 +08:00
var query = client.query({
name: 'fetch',
2010-10-30 09:16:05 +08:00
text: 'select size from boom where size < $1',
values: [101]
});
2010-10-30 09:16:05 +08:00
assert.raises(query, 'row', function(row) {
assert.strictEqual(row.fields[0],100)
});
2010-10-30 09:16:05 +08:00
client.on('drain', client.end.bind(client));
});