|
|
|
@ -18,10 +18,6 @@ var testRange = function(top) {
|
|
|
|
|
var txt = 'COPY (SELECT * from generate_series(0, ' + (top - 1) + ')) TO STDOUT'
|
|
|
|
|
|
|
|
|
|
var stream = fromClient.query(copy(txt))
|
|
|
|
|
var rowEmitCount = 0
|
|
|
|
|
stream.on('row', function() {
|
|
|
|
|
rowEmitCount++
|
|
|
|
|
})
|
|
|
|
|
var done = gonna('finish piping out', 1000, function() {
|
|
|
|
|
fromClient.end()
|
|
|
|
|
})
|
|
|
|
@ -30,7 +26,7 @@ var testRange = function(top) {
|
|
|
|
|
var res = buf.toString('utf8')
|
|
|
|
|
var expected = _.range(0, top).join('\n') + '\n'
|
|
|
|
|
assert.equal(res, expected)
|
|
|
|
|
assert.equal(rowEmitCount, top, 'should have emitted "row" ' + top + ' times but got ' + rowEmitCount)
|
|
|
|
|
assert.equal(stream.rowCount, top, 'should have rowCount ' + top + ' but got ' + stream.rowCount)
|
|
|
|
|
done()
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|