knex/test/tape/stream.js
Jurko Gospodnetić 16a076c1a0 trim trailing spaces
Only left alone ones in `test/tape/transactions.js` which would just
cause unnecessary conflicts and get cleaned up by separate pull
request #1257 anyway.
2016-03-08 08:44:01 +01:00

23 lines
536 B
JavaScript

'use strict';
var tape = require('tape')
var stream = require('readable-stream')
module.exports = function(knex) {
if (knex.client.driverName === 'pg') {
tape('it streams properly in postgres', function(t) {
var w = new stream.Writable({
objectMode: true
})
w._write = function(chunk, _, next) {
setTimeout(next, 10);
}
knex.raw('select * from generate_series(0, 10, 1)').pipe(w).on('finish', function () {
console.log('finished');
t.end()
});
})
}
}