8000 added logging to the hold method by d-stolyar · Pull Request #678 · rx-angular/rx-angular · GitHub
[go: up one dir, main page]

Skip to content

added logging to the hold method #678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
unit test was added
  • Loading branch information
distoliar committed Aug 4, 2021
commit 056bfc0adce03e71d97a0198013e5e9bcc57c482
9 changes: 8 additions & 1 deletion libs/state/spec/rx-state.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { TestScheduler } from 'rxjs/testing';
// tslint:disable-next-line:nx-enforce-module-boundaries
import { RxState, select } from '@rx-angular/state';
import { map, pluck, switchMap, take, takeUntil } from 'rxjs/operators';
import { from, interval, of, Subject } from 'rxjs';
import { from, interval, of, Subject, throwError } from 'rxjs';

function setupState<T extends object>(cfg: { initialState?: T }) {
const { initialState } = { ...cfg };
Expand Down Expand Up @@ -590,5 +590,12 @@ describe('RxStateService', () => {
state.hold(of(1, 2, 3), effect);
expect(calls).toBe(3);
}));

it('should logging error', fakeAsync(() => {
jest.spyOn(console, 'error').mockImplementation();
const state = setupState({ initialState: initialPrimitiveState });
state.hold(throwError(new Error('something went wrong')));
expect(console.error).toHaveBeenCalledWith(new Error('something went wrong'));
}));
});
});
0