Conversation
|
Thanks for your PR, @bynicodevelop. Would you mind adding a simple unit test to make sure it works and prevent other people from accidentally breaking your code in the future? You can take a look at the tests at https://github.com/atn832/firebase_auth_mocks/blob/master/test/firebase_auth_mocks_test.dart and add yours. |
|
Yes, I just did. |
| expect( | ||
| () async => await user!.updateEmail('john@domain.tld'), | ||
| returnsNormally, | ||
| ); |
There was a problem hiding this comment.
Can you add one additional check to verify that the email was updated to the new value?
Also, this test actually changes the value of tUser, which can potentially affect other tests. Would you mind either: 1) initializing your own instance of MockUser in this test
or
2) adding a setUp at the top which reinitializes tUser at every test? Something like:
late MockUser tUser;
setUp(() {
tUser = MockUser(
isAnonymous: false,
//some other values
);
});- might be easier for you to do, while 2) is actually the better way, but might require more work. If you do 1), I'll file a ticket to do 2) in a separate PR.
| tUser.exception = FirebaseAuthException(code: 'invalid-email'); | ||
| final user = auth.currentUser; | ||
| expect( | ||
| () async => await user!.updateEmail('john@domain.tld'), |
There was a problem hiding this comment.
Can you try removing async and await here? It should still work. If it does not, feel fee to leave this as is.
See #70.
| final auth = MockFirebaseAuth(signedIn: true, mockUser: tUser); | ||
| final user = auth.currentUser; | ||
| expect( | ||
| () async => await user!.updateEmail('john@domain.tld'), |
There was a problem hiding this comment.
You may be able to rewrite this as:
expect(
() => user!.updateEmail(...),
completion);or
expectLater(() => user!.updateEmail(...), returnsNormally);Can you try? If it does not work, feel free to leave it as is.
See #70.
Hello,
I added the updateEmail method to test updating a profile.
Maybe this can interest you.