From 78c4ca832c6862600f52b69166830b1331a13d69 Mon Sep 17 00:00:00 2001 From: Brian Carlson Date: Sun, 14 Nov 2010 17:56:18 -0600 Subject: [PATCH] test for row count > result count in cursor row limit --- .../client/prepared-statement-tests.js | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/test/integration/client/prepared-statement-tests.js b/test/integration/client/prepared-statement-tests.js index 5d197a55..b6ab690d 100644 --- a/test/integration/client/prepared-statement-tests.js +++ b/test/integration/client/prepared-statement-tests.js @@ -160,25 +160,40 @@ test('prepared statement', function() { client.query("INSERT INTO zoom (name) VALUES ('postgres')"); client.query("INSERT INTO zoom (name) VALUES ('node postgres')"); - test('with small row count', function() { - var q = client.query({ - name: 'get names', - text: "SELECT name FROM zoom ORDER BY name", - rows: 1 - }); + var checkForResults = function(q) { test('row callback fires for each result', function() { assert.emits(q, 'row', function(row) { assert.equal(row.name, 'node postgres'); - + assert.emits(q, 'row', function(row) { assert.equal(row.name, 'postgres'); - + assert.emits(q, 'row', function(row) { assert.equal(row.name, 'zed'); }) }); }) }) + }; + + test('with small row count', function() { + var query = client.query({ + name: 'get names', + text: "SELECT name FROM zoom ORDER BY name", + rows: 1 + }); + + checkForResults(query); }) + + test('with large row count', function() { + var query = client.query({ + name: 'get names', + text: 'SELECT name FROM zoom ORDER BY name', + rows: 1000 + }) + checkForResults(query); + }) + })