@johngw/stream
Version:
Reactive programming tools using the WHATWG Streams API.
48 lines (42 loc) • 1.3 kB
text/typescript
import { fromTimeline } from '@johngw/stream-jest'
import { SinkComposite } from '@johngw/stream/sinks/SinkComposite'
test('composing underlying sinks', async () => {
const close = jest.fn()
const start = jest.fn()
const write = jest.fn()
await fromTimeline(`
--1--2--3--4--5--|
`).pipeTo(
new WritableStream(
new SinkComposite([
{
close,
start,
write,
},
{
close,
start,
write,
},
])
)
)
expect(close.mock.calls).toEqual([[], []])
expect(start.mock.calls).toEqual([
[],
[],
])
expect(write.mock.calls).toEqual([
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
])
})