Replies: 1 comment
-
Hi Himanshu, thanks for reaching out! I'm afraid I'm not sure why you'd be experiencing tests hanging with One possibility is that the hook is being invoked outside of your test somehow, so you need to provide a mock resolved value to begin with? You could try adding Sorry to not be of more help! Thanks, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, the generated code by PDK provides a method
useDefaultApiClient
for making authenticated calls using SigV4. I need some inputs on understanding how to mock this method for my test cases using Jest in React.There are 2 versions of mocking that I have experimented with:
Version 1:
Version 2:
I'm mostly using
version 1
across my code base. For one my specific source codes, the jest test cases are getting stuck with no termination. I tried to wait around 10mins but the tests were simply stuck, not even timing out. However when I changed the mock to useversion 2
the test cases worked as expected. The source code in the browser is also working as expected.Note: I verified there aren't any infinite loops by logging in both test cases and in the browser console.
I need some inputs on what might be going wrong here ? Any help is appreciated, thanks!
Let me know if more inputs or the source code is also required.
Beta Was this translation helpful? Give feedback.
All reactions