Answer the question
In order to leave comments, you need to log in
How to test Redux saga with jest?
From the documentation, I did not understand how to test such sagas:
function* mySaga() {
yield all([
takeLatest(Types.FETCH_INFO_DISK_REQUEST, fetchDisk),
takeLatest(Types.FETCH_RESOURCES_REQUEST, fetchResources),
takeLatest(Types.DEL_FOLDER_REQUST, del_folder),
takeLatest(Types.CREATE_FOLDER_REQUST, create_folder),
takeLatest(Types.UPLOAD_FILE_REQUST, upload_file),
]);
}
Answer the question
In order to leave comments, you need to log in
const gen = mySaga();
const eff = gen.next().value;
expect(eff).toEqual(
all([
takeLatest(Types.FETCH_INFO_DISK_REQUEST, fetchDisk),
takeLatest(Types.FETCH_RESOURCES_REQUEST, fetchResources),
// ...
]),
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question