Lets say I have a log in and log out function that works with the firebase authentication system.
How would one unit test such a method? The firebase app instance gets imported and used in the log in function.
Code snippet if needed:
export function login(data) {
return dispatch => {
return firebaseAuth.signInWithEmailAndPassword(data.emailField, data.passField)
.then(user => {
dispatch({type: "SET_CURRENT_USER", payload: user})
user.getToken().then(token => setAuthToken(token))
localStorage.setItem("currentUser", JSON.stringify(user))
})
}
}
How can I mock something like this? Should I just set up a test email and password just for the purpose of testing the method? What would be a recommended way?
Thanks!