-
Notifications
You must be signed in to change notification settings - Fork 160
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
Missing fields added to AuthResult #556
Merged
Merged
Changes from 17 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
377b887
Missing fields added to AuthResult
mr-kew a737063
Merge branch 'master' into auth-result
mr-kew 4885a5d
Merge branch 'master' into auth-result
nbransby dcd28c7
Merge branch 'master' into auth-result
nbransby 31d8466
Removed unused import
mr-kew 37867cf
AuthResult test
mr-kew 3a7f273
Merge branch 'master' into auth-result
nbransby 93b9dda
Added messages to asserts in AuthResult test
mr-kew ef5e5d9
JVM lint issues fixed
mr-kew be998c3
JVM lint issues properly fixed
mr-kew f2c2c51
Public api updated
mr-kew ed24041
Public api fix
mr-kew 434abaa
AuthResult structure test allows null values
mr-kew 84cdf2c
AuthResult structure test unwrap fixed
mr-kew a18e3f2
AuthResult structure additionalUserInfo exists
mr-kew 79a7516
AuthResult structure isNewUser default respected
mr-kew ac4cffa
AuthResult structure test made more forgiving
277e7f5
Merge branch 'master' into auth-result
mr-kew e5af67d
AuthResult map parsing fixed in JS
mr-kew 9681cf4
Used Json? instead od dynamic for better clarity
mr-kew fad3664
AuthResult structure JS test fixed
mr-kew 60e42c0
Merge branch 'master' into auth-result
mr-kew b566e31
Merge cleanup
mr-kew 1a9a14a
API dump
mr-kew 3eb1a0c
Native properties moved into extensions
mr-kew ecfa47d
Merge branch 'master' into auth-result
nbransby 9e8ef04
Update auth.kt
nbransby File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,6 +127,21 @@ class FirebaseAuthTest { | |
assertEquals("password", credential.providerId) | ||
} | ||
|
||
@Test | ||
fun testAuthResultStructure() = runTest { | ||
val uid = getTestUid("[email protected]", "test123") | ||
val result = auth.signInWithEmailAndPassword("[email protected]", "test123") | ||
assertNotNull(result.user, "User does not exist.") | ||
assertEquals(uid, result.user!!.uid, "uid does not match.") | ||
assertNull(result.credential, "Credential throws.") | ||
assertNotNull(result.additionalUserInfo, "AdditionalUserInfo does not exist.") | ||
// Just test if it does not throw | ||
result.additionalUserInfo!!.providerId | ||
result.additionalUserInfo!!.username | ||
result.additionalUserInfo!!.profile | ||
result.additionalUserInfo!!.isNewUser | ||
} | ||
|
||
private suspend fun getTestUid(email: String, password: String): String { | ||
val uid = auth.let { | ||
val user = try { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why cant the constructor stay internal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just feel like there is no need for it to be internal. Having it public just allows more flexibility for the library. People can define their own extensions for stuff that is platform specific etc (like my example) and still keep the common types from the library.
I mean sure, in my example I could redefine the
AuthResult
in my own code and use that instead and this PR kinda removes the need for that code all together. But still the constructor being internal seems like an unnecessary obstacle forcing me to write something that is already there, while offering not much benefit elsewhere.It's definitely up to discussion, depends if there are any more serious reasons for it to be internal in the first place.