Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose MockUserCredential #92

Open
thedalelakes opened this issue Feb 15, 2023 · 2 comments
Open

Expose MockUserCredential #92

thedalelakes opened this issue Feb 15, 2023 · 2 comments

Comments

@thedalelakes
Copy link
Contributor

thedalelakes commented Feb 15, 2023

Currently, if I want to mock the method User.linkWithProvider, which returns a UserCredential, I have to implement my own mock for UserCredential.

I'd prefer to simply re-use your implementation so I can have something like the following:

when(() => firebaseAuth.currentUser!.linkWithProvider(any()))
              .thenAnswer((_) async => Future.value(MockUserCredential(
                        mockUser: firebaseAuth.currentUser!,
              ));

Any reason why MockUserCredential shouldn't be exported and made available?

@atn832
Copy link
Owner

atn832 commented Mar 13, 2023

Despite the name, firebase_auth_mocks tries to fake as much as possible as you did so well in #91 (thanks btw!), so we don't want to use Mockito's pattern of mocking custom values.

Btw we don't export MockUserCredential and other custom implementations of the Firestore API because unit tests should use the public Firestore API as much as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@atn832 @thedalelakes and others