Skip to content

Commit 9cc3e52

Browse files
committed
add failing test for noData queries
1 parent f7b6572 commit 9cc3e52

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/no-data-handling.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var assert = require('assert')
2+
var pg = require('pg.js');
3+
var Cursor = require('../');
4+
5+
describe('queries with no data', function () {
6+
beforeEach(function(done) {
7+
var client = this.client = new pg.Client()
8+
client.connect(done)
9+
})
10+
11+
12+
afterEach(function() {
13+
this.client.end()
14+
})
15+
16+
it('handles queries that return no data', function (done) {
17+
var cursor = new Cursor('CREATE TEMPORARY TABLE whatwhat (thing int)')
18+
this.client.query(cursor)
19+
cursor.read(100, function (err, rows) {
20+
assert.ifError(err)
21+
assert.equal(rows.length, 0)
22+
done()
23+
})
24+
});
25+
});

0 commit comments

Comments
 (0)