mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
* feat(): start converting pg-query stream * feat(): solution project, initial version of typescript-pg-query stream * chore(): mocha with typescript * fix(): eslint ignore query stream dist * refactor(pg-query-stream): convert test to ts * chore(): fixed type errors * chore(): fix helper usage * chore(): use ts-node compatibile with node v8 * fix(): addd es extension * chore(): remove emitClose and added compilation for async iterators * chore(): condition for asyc iteration test * chore(): rename class to match ts-defs * chore(): tests to import from src instead of dist * chore(): remove prettier from peer deps: * chore(): update lock file
27 lines
806 B
TypeScript
27 lines
806 B
TypeScript
import helper from './helper'
|
|
import QueryStream from '../src'
|
|
import spec from 'stream-spec'
|
|
import assert from 'assert'
|
|
|
|
helper('stream tester timestamp', function (client) {
|
|
it('should not warn about max listeners', function (done) {
|
|
const sql = "SELECT * FROM generate_series('1983-12-30 00:00'::timestamp, '2013-12-30 00:00', '1 years')"
|
|
const stream = new QueryStream(sql, [])
|
|
let ended = false
|
|
const query = client.query(stream)
|
|
query.on('end', function () {
|
|
ended = true
|
|
})
|
|
spec(query).readable().pausable({ strict: true }).validateOnExit()
|
|
const checkListeners = function () {
|
|
assert(stream.listeners('end').length < 10)
|
|
if (!ended) {
|
|
setImmediate(checkListeners)
|
|
} else {
|
|
done()
|
|
}
|
|
}
|
|
checkListeners()
|
|
})
|
|
})
|