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

Help with making test not timeout when using .then after .run #375

Open
anwarhamr opened this issue Oct 10, 2021 · 0 comments
Open

Help with making test not timeout when using .then after .run #375

anwarhamr opened this issue Oct 10, 2021 · 0 comments

Comments

@anwarhamr
Copy link

I have this test

expectSaga(sessionHandoffHandler)
                    //@ts-ignore
                    .withReducer(rootReducer)
                    .dispatch(handoffAction)
                    .put({type: Actions.SESSION_STARTED})
                    .run()
                    .then((result: {storeState: RootState}) => {
                        // console.log('************', result);
                        let session = sessionState(result.storeState);
                        expect(session.status).toEqual(SessionStatusEnum.HandingOff);
                        expect(session.sensors.length).toEqual(4);
                        expect(session.currentScreen).toEqual('HandoffScreen');
                    })

I get this error message from every test structured as above.
[WARNING]: Saga exceeded async timeout of 500ms
500 because I used
expectSaga.DEFAULT_TIMEOUT = 500;
no matter what value I put in the default timeout I get that warning.
I know I can use silent but that seems wrong since I want the warning if it's real.

I have tried to use the done() method for the jest test but still get the warning...

I saw testSaga but that didn't seem to work the same, am I wrong if so how would I write the above as testSaga()?

Lastly I don't want to use .hasFinalState because I don't really want to have to add all of the values from multiple reducers for many reasons...
Please help.

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