How to unit test firebase auth in a NextJS project? Error (auth/invalid-api-key). #6138
Unanswered
wick3ds0ul
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to setup and unit test
firebase auth
in a Next JS project, that uses server side rendering.Setup:
package.json
I want to unit test the parts of the code where there is conditional rendering based on if user is logged in.
Firebase does not seem to have much resources for unit testing for authentication.
Error:
Here is
AuthProvider.tsx
that wraps around the entire app.Here is the provider wrapping around the children elements in
_app.tsx
Here is an example of the test setup that depends on the user has been logged in or not.
Code that depends on the user state that is logged in.
header.tsx
Here is a
test-util.tsx
I can confirm that the Keys are correct and it does work on local and allows me to sign in.
Beta Was this translation helpful? Give feedback.
All reactions