@@ -111,6 +111,22 @@ class FirebaseAuthTest {
111
111
assertEquals(uid, result.user!! .uid)
112
112
}
113
113
114
+ @Test
115
+ fun testAuthResultStructure () = runTest {
116
+ val uid
= getTestUid(
" [email protected] " ,
" test123" )
117
+ val result
= auth.signInWithEmailAndPassword(
" [email protected] " ,
" test123" )
118
+ assertNotNull(result.user, " User does not exist." )
119
+ assertEquals(uid, result.user!! .uid, " uid does not match." )
120
+ assertNull(result.credential, " Credential throws." )
121
+ // Just test if it does not throw
122
+ result.additionalUserInfo?.let { additionalUserInfo ->
123
+ additionalUserInfo.providerId
124
+ additionalUserInfo.username
125
+ additionalUserInfo.profile
126
+ additionalUserInfo.isNewUser
127
+ }
128
+ }
129
+
114
130
@Test
115
131
fun testIsSignInWithEmailLink () {
116
132
val validLink = " http://localhost:9099/emulator/action?mode=signIn&lang=en&oobCode=_vr0QcFcxcVeLZbrcU-GpTaZiuxlHquqdC8MSy0YM_vzWCTAQgV9Jq&apiKey=fake-api-key&continueUrl=https%3A%2F%2Fexample.com%2Fsignin"
@@ -127,21 +143,6 @@ class FirebaseAuthTest {
127
143
assertEquals(" password" , credential.providerId)
128
144
}
129
145
130
- @Test
131
- fun testAuthResultStructure () = runTest {
132
- val uid
= getTestUid(
" [email protected] " ,
" test123" )
133
- val result
= auth.signInWithEmailAndPassword(
" [email protected] " ,
" test123" )
134
- assertNotNull(result.user, " User does not exist." )
135
- assertEquals(uid, result.user!! .uid, " uid does not match." )
136
- assertNull(result.credential, " Credential throws." )
137
- assertNotNull(result.additionalUserInfo, " AdditionalUserInfo does not exist." )
138
- // Just test if it does not throw
139
- result.additionalUserInfo!! .providerId
140
- result.additionalUserInfo!! .username
141
- result.additionalUserInfo!! .profile
142
- result.additionalUserInfo!! .isNewUser
143
- }
144
-
145
146
private suspend fun getTestUid (email : String , password : String ): String {
146
147
val uid = auth.let {
147
148
val user = try {
0 commit comments