error tests
This commit is contained in:
parent
b7c3db5f32
commit
567446e090
@ -46,8 +46,8 @@ p.connect = function() {
|
||||
})
|
||||
}
|
||||
|
||||
p.query = function(config) {
|
||||
var q = new NativeQuery(config);
|
||||
p.query = function(config, values) {
|
||||
var q = new NativeQuery(config, values);
|
||||
this._queryQueue.push(q);
|
||||
this._pulseQueryQueue();
|
||||
return q;
|
||||
|
@ -102,6 +102,10 @@ public:
|
||||
if(!args[0]->IsString()) {
|
||||
return ThrowException(Exception::Error(String::New("First parameter must be a string query")));
|
||||
}
|
||||
printf("testing for logs","");
|
||||
if(!args[1]->IsArray()) {
|
||||
return ThrowException(Exception::Error(String::New("Values must be array")));
|
||||
}
|
||||
|
||||
String::Utf8Value queryText(args[0]->ToString());
|
||||
int result = self->Send(*queryText);
|
||||
|
@ -27,3 +27,35 @@ test('parameterized query with non-text as first parameter throws error', functi
|
||||
})
|
||||
})
|
||||
|
||||
var connect = function(callback) {
|
||||
var client = new Client(conString);
|
||||
client.connect();
|
||||
assert.emits(client, 'connect', function() {
|
||||
callback(client);
|
||||
})
|
||||
}
|
||||
|
||||
test('parameterized query with non-array for second value', function() {
|
||||
test('inline', function() {
|
||||
connect(function(client) {
|
||||
assert.throws(function() {
|
||||
client.query("SELECT *", "LKSDJF")
|
||||
})
|
||||
client.end();
|
||||
})
|
||||
})
|
||||
test('config', function() {
|
||||
|
||||
connect(function(client) {
|
||||
assert.throws(function() {
|
||||
client.query({
|
||||
text: "SELECT *",
|
||||
values: "ALSDKFJ"
|
||||
})
|
||||
})
|
||||
client.end();
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user