ngrx-store-effects-app
ngrx-store-effects-app copied to clipboard
testing effect Error
Hi there,
I correctly understand the testing Effects. Nevertheless, I encounter an error when I try to test a Http Failed mocked.
Is that possible to add a fail test case?
I encounter this kind of error:
Error: Expected $[1].frame = 0 to equal 10.
the test case:
it('should return GetFailedAction action, with the errror, on fail', async () => {
const { effects, TodoService, actions$ } = setup()
const action = new GetAction()
const errorMsg = {message: 'Error: an error 40X occured'}
const expectedResult = new GetFailedAction(errorMsg.message)
// mock this function which we can test later on, due to the promise issue
spyOn(effects, 'getTodo').and.returnValue(Observable.throw(errorMsg))
actions$.stream = hot('a|', { a: action });
const expected = cold('b|', { b: expectedResult })
expect(effects.getTodo$).toBeObservable(expected)
// expect(effects.getTodo).toHaveBeenCalled()
})