Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

282
Views
El caso de prueba fallida de Jest Redux Sagas falla, aunque pasa un caso similar

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 error

Tambié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')) ); });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!