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

358
Views
How to mock .then() and .catch() in Jest?

can anyone please give me an example of how can I mock .then() block and .catch() block in Jest I am trying to test AWS cognito.signUp().then().catch() but returning TypeError: cognito.signUp(...).then(...).catch is not a function

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The then and catch in this case are functions related to Promises. So what you probably want to do here is to mock the cognito.signUp function to return a promise.

You can find an example from here: https://jestjs.io/docs/tutorial-async

about 4 years ago · Juan Pablo Isaza Report
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!