node-postgres/test/native/error-tests.js

30 lines
781 B
JavaScript
Raw Normal View History

var helper = require(__dirname + "/../test-helper");
var Client = require(__dirname + "/../../lib/native").Client;
var conString = helper.connectionString();
test('query with non-text as first parameter throws error', function() {
var client = new Client(conString);
client.connect();
assert.emits(client, 'connect', function() {
2011-02-25 11:50:17 +08:00
assert.throws(function() {
client.query({text:{fail: true}});
2011-02-25 11:50:17 +08:00
})
client.end();
})
})
2011-02-25 11:50:17 +08:00
test('parameterized query with non-text as first parameter throws error', function() {
var client = new Client(conString);
client.connect();
assert.emits(client, 'connect', function() {
assert.throws(function() {
client.query({
text: {fail: true},
values: [1, 2]
})
})
client.end();
})
})