jest-fp-ts-matchers
TypeScript icon, indicating that this package has built-in type declarations

0.4.1 • Public • Published

jest-fp-ts-matchers

Collection of monad matchers to ease testing with Jest

Installation

npm install -D jest-fp-ts-matchers

Quick start

import { expectLeftEither } from 'jest-fp-ts-matchers';

test('returns left Either when parsing fails', () => {
  pipe(
    Parser.parse({ id: '' }),
    expectLeftEither((err) => {
      expect(err).toBeInstanceOf(Error);
      expect(err.message).toMatch(/001/);
    })
  );
});

Exported methods

  • expectLeftEither
  • expectRightEither
  • expectLeftΙΟEither
  • expectRightΙΟEither
  • expectLeftTaskEither
  • expectRightTaskEither
  • expectLeftReaderTaskEither
  • expectRightReaderTaskEither
  • expectSomeOption
  • expectNoneOption

Requirements

  • Node.js v.16+

License

MIT

Dependencies (0)

    Dev Dependencies (20)

    Package Sidebar

    Install

    npm i jest-fp-ts-matchers

    Weekly Downloads

    324

    Version

    0.4.1

    License

    MIT

    Unpacked Size

    34.6 kB

    Total Files

    55

    Last publish

    Collaborators

    • nikoskalogridis
    • dnlytras
    • jmike