UNPKG

@yoroi/common

Version:
38 lines (37 loc) 937 B
"use strict"; import { isLeft, isRight } from './monads'; describe('Either helper functions', () => { describe('isLeft', () => { it('returns true if Either is Left', () => { const left = { tag: 'left', error: new Error('Error') }; expect(isLeft(left)).toBe(true); }); it('returns false if Either is Right', () => { const right = { tag: 'right', value: 'Success' }; expect(isLeft(right)).toBe(false); }); }); describe('isRight', () => { it('returns true if Either is Right', () => { const right = { tag: 'right', value: 'Success' }; expect(isRight(right)).toBe(true); }); it('returns false if Either is Left', () => { const left = { tag: 'left', error: new Error('Error') }; expect(isRight(left)).toBe(false); }); }); }); //# sourceMappingURL=monads.test.js.map