more asertions for simple query test

This commit is contained in:
brianc 2010-10-26 01:47:05 -05:00
parent 490bfdaebd
commit 6699cccafe

View File

@ -1,16 +1,26 @@
var helper = require(__dirname+"/test-helper");
//before running this test make sure you run the script create-test-tables
test("selects rows", function() {
test("simple query interface", function() {
var client = helper.client();
var query = client.query("select * from person");
var rowCount = 0;
var query = client.query("select name from person");
var rows = [];
query.on('row', function(row) {
rowCount++;
rows.push(row.fields[0])
});
assert.raises(query, 'end', function() {
assert.equal(rowCount, 26);
test("returned right number of rows", function() {
assert.length(rows, 26);
});
test("row ordering", function(){
assert.equal(rows[0], "Aaron");
assert.equal(rows[25], "Zanzabar");
});
client.end();
});
});