Skip to content

Commit 6b105cc

Browse files
authored
chore: Update tests for getting and deleting provider uid via phone number and email. (#1068)
1 parent 4611743 commit 6b105cc

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/test/java/com/google/firebase/auth/FirebaseUserManagerTest.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,19 +402,23 @@ public void testGetUserByProviderUidWithPhone() throws Exception {
402402
TestResponseInterceptor interceptor = initializeAppForUserManagement(
403403
TestUtils.loadResource("getUser.json"));
404404
UserRecord userRecord = FirebaseAuth.getInstance()
405-
.getUserByProviderUidAsync("phone", "+1234567890").get();
405+
.getUserByProviderUidAsync(new String("phone"), "+1234567890").get();
406406
checkUserRecord(userRecord);
407407
checkRequestHeaders(interceptor);
408+
GenericJson parsed = parseRequestContent(interceptor);
409+
assertEquals(ImmutableList.of("+1234567890"), parsed.get("phoneNumber"));
408410
}
409411

410412
@Test
411413
public void testGetUserByProviderUidWithEmail() throws Exception {
412414
TestResponseInterceptor interceptor = initializeAppForUserManagement(
413415
TestUtils.loadResource("getUser.json"));
414416
UserRecord userRecord = FirebaseAuth.getInstance()
415-
.getUserByProviderUidAsync("email", "[email protected]").get();
417+
.getUserByProviderUidAsync(new String("email"), "[email protected]").get();
416418
checkUserRecord(userRecord);
417419
checkRequestHeaders(interceptor);
420+
GenericJson parsed = parseRequestContent(interceptor);
421+
assertEquals(ImmutableList.of("[email protected]"), parsed.get("email"));
418422
}
419423

420424
@Test
@@ -1248,20 +1252,22 @@ public void testDeleteProviderAndPhone() {
12481252

12491253
@Test
12501254
public void testDoubleDeletePhoneProvider() throws Exception {
1255+
String providerId = new String("phone");
12511256
UserRecord.UpdateRequest update = new UserRecord.UpdateRequest("uid")
12521257
.setPhoneNumber(null);
12531258

12541259
try {
1255-
update.setProvidersToUnlink(ImmutableList.of("phone"));
1260+
update.setProvidersToUnlink(ImmutableList.of(providerId));
12561261
fail("No error thrown for double delete phone provider");
12571262
} catch (IllegalArgumentException expected) {
12581263
}
12591264
}
12601265

12611266
@Test
12621267
public void testDoubleDeletePhoneProviderReverseOrder() throws Exception {
1268+
String providerId = new String("phone");
12631269
UserRecord.UpdateRequest update = new UserRecord.UpdateRequest("uid")
1264-
.setProvidersToUnlink(ImmutableList.of("phone"));
1270+
.setProvidersToUnlink(ImmutableList.of(providerId));
12651271

12661272
try {
12671273
update.setPhoneNumber(null);

0 commit comments

Comments
 (0)