mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-25 16:03:13 +00:00
more asertions for simple query test
This commit is contained in:
parent
490bfdaebd
commit
6699cccafe
@ -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();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user