-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtapAsync.spec.ts
More file actions
31 lines (23 loc) · 753 Bytes
/
tapAsync.spec.ts
File metadata and controls
31 lines (23 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { Maybe } from '@/src/maybe';
describe('Maybe', () => {
describe('tapAsync', () => {
test('executes the async Action and transforms to a MaybeAsync when the Maybe has a value', () => {
const sut = Maybe.some(10);
let wasCalled = false;
sut.tapAsync((_number) => {
wasCalled = true;
return Promise.resolve();
});
expect(wasCalled).toBe(true);
});
test('performs no action and transforms to a MaybeAsync with no value for for Maybes with no value', () => {
const sut = Maybe.none<number>();
let wasCalled = false;
sut.tap((_number) => {
wasCalled = true;
return Promise.resolve();
});
expect(wasCalled).toBe(false);
});
});
});