diff --git a/Example/Auth/Tests/FIRPhoneAuthProviderTests.m b/Example/Auth/Tests/FIRPhoneAuthProviderTests.m index 8e1417312a3..564f888fcb3 100644 --- a/Example/Auth/Tests/FIRPhoneAuthProviderTests.m +++ b/Example/Auth/Tests/FIRPhoneAuthProviderTests.m @@ -393,8 +393,14 @@ - (void)testVerifyPhoneNumberUIDelegate { // `callbackMatcher` is at index 4 [invocation getArgument:&unretainedArgument atIndex:4]; FIRAuthURLCallbackMatcher callbackMatcher = unretainedArgument; - NSURLComponents *originalComponents = - [[NSURLComponents alloc] initWithString:kFakeRedirectURLStringWithReCAPTCHAToken]; + NSMutableString *redirectURL = + [NSMutableString stringWithString:kFakeRedirectURLStringWithReCAPTCHAToken]; + // Verify that the URL is rejected by the callback matcher without the event ID. + XCTAssertFalse(callbackMatcher([NSURL URLWithString:redirectURL])); + [redirectURL appendString:@"%26eventId%3D"]; + [redirectURL appendString:params[@"eventId"]]; + NSURLComponents *originalComponents = [[NSURLComponents alloc] initWithString:redirectURL]; + // Verify that the URL is accepted by the callback matcher with the matching event ID. XCTAssertTrue(callbackMatcher([originalComponents URL])); NSURLComponents *components = [originalComponents copy]; components.query = @"https";