@johngw/stream-jest

1.0.3 • Public • Published

@johngw/stream-jest

Jest extension for testing streams.

Usage

npm i @johngw/stream-test @johngw/stream-jest
// jest.config.ts

import { Config } from 'jest'

const conig: Config = {
  // ...
  setupFilesAfterEnv: [require.resolve('@johngw/stream-test/polyfill')],
}

API

toMatchTimeline()

// test/pairwise.ts

import { fromTimeline, pairwise } from '@johngw/stream'
import { fromTimeline } from '@johngw/stream-jest'

test('Queues the current value and previous values', async () => {
  await expect(
    fromTimeline(`
    --1--2------3------4------5------|
  `).pipeThrough(pairwise())
  ).toMatchTimeline(`
    -----[1,2]--[2,3]--[3,4]--[4,5]--
  `)
})

Readme

Keywords

none

Package Sidebar

Install

npm i @johngw/stream-jest

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

208 kB

Total Files

17

Last publish

Collaborators

  • johngeorgewright