diff options
author | Zsika Phillip <protocol86@users.noreply.github.com> | 2017-09-14 13:30:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-14 13:30:58 -0700 |
commit | f1c81936dd3478d23d19832d7ee6cd209aef9182 (patch) | |
tree | 3f016d489583be92dde6bac23b51f7c296eef5dc /Example/Auth/Tests | |
parent | b8f70da4ee4310b48addf046923a090d52839bef (diff) |
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.
Diffstat (limited to 'Example/Auth/Tests')
-rw-r--r-- | Example/Auth/Tests/FIRPhoneAuthProviderTests.m | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Example/Auth/Tests/FIRPhoneAuthProviderTests.m b/Example/Auth/Tests/FIRPhoneAuthProviderTests.m index 8e14173..564f888 100644 --- a/Example/Auth/Tests/FIRPhoneAuthProviderTests.m +++ b/Example/Auth/Tests/FIRPhoneAuthProviderTests.m @@ -393,8 +393,14 @@ static const NSTimeInterval kExpectationTimeout = 1; // `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"; |