UNPKG

@yoroi/common

Version:

The Common package of Yoroi SDK

36 lines 922 B
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