Skip to content
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

testing effect Error #20

Open
GuillaumeUnice opened this issue Mar 29, 2018 · 0 comments
Open

testing effect Error #20

GuillaumeUnice opened this issue Mar 29, 2018 · 0 comments

Comments

@GuillaumeUnice
Copy link

GuillaumeUnice commented Mar 29, 2018

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()

})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant