Skip to content

Commit

Permalink
fix: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dankreiger committed Oct 1, 2021
1 parent d435a58 commit 19c0988
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/Either/Right/Right.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
import { Right } from '.';

describe('Right', () => {
test('smoke', () => {
expect(Right(10).inspect()).toBe('Right(10)');
test('map', () => {
const mapped = Right(10).map((x) => x + 20);
expect(
Right(10)
.map((x) => x + 20)
.inspect()
).toBe('Right(30)');
mapped.fold(
(_) => _,
(x) => x
)
).toEqual(30);
});

test('chain', () => {
const chained = Right(10).chain((x) => Right(20 + x));
expect(
chained.fold(
(err) => err,
(x) => x
)
).toEqual(30);
});
});

0 comments on commit 19c0988

Please sign in to comment.