Skip to content

Commit f1c8193

Browse files
authored
Modifies unit tests to accommodate event ID check (#270)
* Modifies unit tests to accommodate event ID check * Extracts event ID from outgoing URL * Addresses comments Checks that the URL is rejected by the callback matcher without the event ID.
1 parent b8f70da commit f1c8193

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Example/Auth/Tests/FIRPhoneAuthProviderTests.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,14 @@ - (void)testVerifyPhoneNumberUIDelegate {
393393
// `callbackMatcher` is at index 4
394394
[invocation getArgument:&unretainedArgument atIndex:4];
395395
FIRAuthURLCallbackMatcher callbackMatcher = unretainedArgument;
396-
NSURLComponents *originalComponents =
397-
[[NSURLComponents alloc] initWithString:kFakeRedirectURLStringWithReCAPTCHAToken];
396+
NSMutableString *redirectURL =
397+
[NSMutableString stringWithString:kFakeRedirectURLStringWithReCAPTCHAToken];
398+
// Verify that the URL is rejected by the callback matcher without the event ID.
399+
XCTAssertFalse(callbackMatcher([NSURL URLWithString:redirectURL]));
400+
[redirectURL appendString:@"%26eventId%3D"];
401+
[redirectURL appendString:params[@"eventId"]];
402+
NSURLComponents *originalComponents = [[NSURLComponents alloc] initWithString:redirectURL];
403+
// Verify that the URL is accepted by the callback matcher with the matching event ID.
398404
XCTAssertTrue(callbackMatcher([originalComponents URL]));
399405
NSURLComponents *components = [originalComponents copy];
400406
components.query = @"https";

0 commit comments

Comments
 (0)