Having trouble testing a fetch that returns a readable stream for an image. Not sure how to approach this specific case. Is there a simple way to mock the call's response?
Any assistance would be greatly appreciated :D
This is how the generator function looks like:
export function* getImageSaga () {
try {
const headers = {
Accept: 'image/jpeg',
};
const options = {
headers,
method: 'GET',
};
const response = yield call(fetch, GET_IMAGE_API, options);
const blob = yield response.blob();
const url = URL.createObjectURL(blob);
yield put(getImageSuccess(url));
} catch (error) {
yield put(getImageError(error));
}
}