Marcin K 78a14a164d
feat(): pg-query-stream typescript (#2376)
* 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
2020-11-03 11:17:49 -06:00

27 lines
746 B
TypeScript

import assert from 'assert'
import QueryStream from '../src'
describe('stream config options', () => {
// this is mostly for backwards compatibility.
it('sets readable.highWaterMark based on batch size', () => {
const stream = new QueryStream('SELECT NOW()', [], {
batchSize: 88,
})
assert.equal(stream.readableHighWaterMark, 88)
})
it('sets readable.highWaterMark based on highWaterMark config', () => {
const stream = new QueryStream('SELECT NOW()', [], {
highWaterMark: 88,
})
assert.equal(stream.readableHighWaterMark, 88)
})
it('defaults to 100 for highWaterMark', () => {
const stream = new QueryStream('SELECT NOW()', [])
assert.equal(stream.readableHighWaterMark, 100)
})
})