Difficulty in mocking an async function from external library #28090
vaibhav6496
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've a function used in my Angular app from a library: '@sec/blindfold'. The function name is
encryptStr
. It's an async function with signature as below:async function encryptStr(data: EncryptInput): Promise<StringResult>
whereStringResult
is an interface below:The
encryptStr
calls bunch of external APIs, so instead of intercepting those calls I tried to stub theencryptStr
in my cypress tests like below:However, I can still see the original
encryptStr
is being called as the network tab shows call to the external APIs. Am I missing something? How to stub such an external async function's response in cypress?Beta Was this translation helpful? Give feedback.
All reactions