Mock firebase for API route authentication #13651
Unanswered
tettoffensive
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have an API route that I want to test /pages/api/login.ts:
I am trying to test it with the following, however, I would like to mock firebase so that I can get expectations such as
"sends email sign in link"
to pass.I've tried creating a
__mocks__/firebase/auth.js
file. But according to jest docs:But my firebase import statements are in my API route code, not in my test file.
Any suggestions as to how to get this working? I'm open to suggestions if this is not a good way to test API routes.
Beta Was this translation helpful? Give feedback.
All reactions