Collection of monad matchers to ease testing with Jest
npm install -D jest-fp-ts-matchers
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/);
})
);
});
expectLeftEither
expectRightEither
expectLeftΙΟEither
expectRightΙΟEither
expectLeftTaskEither
expectRightTaskEither
expectLeftReaderTaskEither
expectRightReaderTaskEither
expectSomeOption
expectNoneOption
- Node.js v.16+
MIT