Skip to content

Commit

Permalink
test: Increased the coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mnasyrov committed Jul 25, 2021
1 parent 3645c92 commit a805a52
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/rx-effects/src/effect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,29 @@ describe('Effect', () => {
expect(await final).toBe(1);
});

it('should handle completion of the observable', async () => {
const effect = createEffect((value: number) => value * 2);

const onSourceCompleted = jest.fn();
effect.handle(of(1), {
onSourceCompleted,
});

expect(onSourceCompleted).toBeCalledTimes(1);
});

it('should handle an error of the observable', async () => {
const effect = createEffect((value: number) => value * 2);

const onSourceFailed = jest.fn();
effect.handle(throwError(new Error('test error')), {
onSourceFailed,
});

expect(onSourceFailed).toBeCalledTimes(1);
expect(onSourceFailed).toBeCalledWith(new Error('test error'));
});

it('should handle error from the source', async () => {
const effect = createEffect((value: number) => value * 2);

Expand Down

0 comments on commit a805a52

Please sign in to comment.