Estoy probando las sagas en mi aplicación, y tengo este caso de prueba fallida que arroja un error, aunque otros casos similares de prueba fallida están funcionando
El caso en cuestión a continuación
// Code to be tested export function* fetchCollectionsAsync() { try { const collectionRef = firestore.collection("collections"); const snapshot = yield collectionRef.get(); const collectionsMap = yield call( convertCollectionsSnapshotToMap, snapshot ); yield put(fetchCollectionsSuccess(collectionsMap)); } catch (error) { yield put(fetchCollectionsFailure(error.message)); } } // Test case it("should fire fetchCollectionsFailure if get collection fails at any point", () => { const newGenerator = fetchCollectionsAsync(); newGenerator.next(); expect(newGenerator.throw({ message: "error" }).value).toEqual( put(fetchCollectionsFailure("error")) ); });pero esta tirando
FAIL src/redux/shop/shop.sagas.test.js ● fetch collections async saga › should fire fetchCollectionsFailure if get collection fails at any point errorTambién tengo este caso para una saga diferente, que es más o menos el mismo código para el caso de prueba, pero pasa
// Code to be tested export function* isUserAuthenticated() { try { const userAuth = yield getCurrentUser(); if (!userAuth) return; yield getSnapshotFromUserAuth(userAuth); } catch (error) { yield put(signInFailure(error)); } } // Test case it('should call signInFailure on error', () => { const newGenerator = isUserAuthenticated(); newGenerator.next(); expect(newGenerator.throw('error').value).toEqual( put(signInFailure('error')) ); });