2011-02-25 11:44:03 +08:00
|
|
|
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() {
|
2011-02-25 11:44:03 +08:00
|
|
|
client.query({text:{fail: true}});
|
2011-02-25 11:50:17 +08:00
|
|
|
})
|
2011-02-25 11:44:03 +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();
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|