redux-saga-test-plan
redux-saga-test-plan copied to clipboard
Help with making test not timeout when using .then after .run
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.