/** * Root saga manages watcher lifecycle */ export function* githubRepoFormSaga() { // Watches for loadRepos actions and calls getRepos when one comes in. // By using `takeLatest` only the result of the latest API call is applied. // It returns task descriptor (just like fork) so we can continue execution // It will be cancelled automatically on component unmount yield takeLatest(actions.loadRepos.type, getRepos); }
it('should display loading indicator when state is loading', () => { store.dispatch(actions.loadRepos()); expect(component.container.querySelector('circle')).toBeInTheDocument(); });
expect(slice.reducer(state, slice.actions.loadRepos())).toEqual({ ...slice.initialState, loading: true,
/** * Root saga manages watcher lifecycle */ export function* githubRepoFormSaga() { // Watches for loadRepos actions and calls getRepos when one comes in. // By using `takeLatest` only the result of the latest API call is applied. // It returns task descriptor (just like fork) so we can continue execution // It will be cancelled automatically on component unmount yield takeLatest(actions.loadRepos.type, getRepos); }
it('should display loading indicator when state is loading', () => { store.dispatch(actions.loadRepos()); expect(component.container.querySelector('circle')).toBeInTheDocument(); });
expect(slice.reducer(state, slice.actions.loadRepos())).toEqual({ ...slice.initialState, loading: true,