soumak77 / firebase-mock

Firebase mock library for writing unit tests
https://soumak77.github.io/firebase-mock
350 stars 96 forks source link

signInWithEmailAndPassword returns user, not UserCredential #120

Open BrianChapman opened 5 years ago

BrianChapman commented 5 years ago

The signInWithEmailAndPassword method is supposed to return a promise containing [UserCredential] (https://firebase.google.com/docs/reference/js/firebase.auth#.UserCredential) but it returns a partial user object (https://github.com/soumak77/firebase-mock/blob/master/src/firebase-auth.js#L124)

In fact all return a UserCredential except signInWithCredential which does return a user, signInWithPhoneNumber which returns a ConfirmationResult, and signInWithRedirect which returns void.

ghost commented 5 years ago

I've just submitted a pull request that similarly modifies createUserWithEmailAndPassword.

brandonpearcy commented 4 years ago

+1 This really caught me off guard when we first started to use firebase-mock. After digging through the source, finally figured out that the API of firebase-mock differs from that of the actual Firebase SDK. It makes it hard to actually use firebase-mock in production code, because we would have to adjust the code to handle two APIs (and risk hard-to-catch bugs).