-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Another question regarding testing order and number of triggered actions.
Let's say I have a search()
action that triggers searchLoading()
and then searchResults()
.
If a search action is coming before the previous is finished, it cancels it (that would happen when typing in a search box, for example)
I would like to do the following:
it('cancels the previous call if any', async done => {
const dispatchThreeSearches = () => async dispatch => {
dispatch(searchBidders({ keyword: 'test1' }))
dispatch(searchBidders({ keyword: 'test2' }))
await dispatch(searchBidders({ keyword: 'test3' }))
}
expect(dispatchThreeSearches())
.toDispatchActions([
searchLoading(),
searchLoading(),
searchLoading(),
searchResults({ results: mockedResultsForTest3Keyword })
])
})
After a few tests of the above code, it appears that each action is matched independently of the others, which means it is not possible to test:
- Order of dispatched actions
- Number of dispatching of the same action (I could put 100's of
searchLoading()
and it would still pass)
Do you see a way to achieve a more fine grained control over expected actions?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels