-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
For composite sagas with no direct action triggers, but only generator yield calls, how do we mock those yield calls with redux-saga-tester
?
function* onFetchBooks(action) {
const { genre = '', page = 1 } = action.payload
const updatedAction = { ...action, payload: { name: searchText, page, page_size: 20 } }
if (genre === 'Fiction') {
yield fetchFiction(action.payload)
} else if (genre === 'NonFiction') {
yield fetchNonFiction(action.payload)
} else {
yield fetchAll(action.payload)
}
}
*Note: onFetchBooks
, fetchFiction
, fetchNonFiction
and fetchAll
are in the same file
Mocking with jest also doesn't seems to work.
jest.fn(fetchFiction)
jest.fn(fetchNonFiction)
jest.fn(fetchAll)
Also, there isn't a way to mock in the SagaTester
constructor or the .start()
method as well.
Can someone help with this query?
Metadata
Metadata
Assignees
Labels
No labels