diff options
Diffstat (limited to 'Example/Auth/Tests/FIRVerifyPhoneNumberRequestTests.m')
-rw-r--r-- | Example/Auth/Tests/FIRVerifyPhoneNumberRequestTests.m | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Example/Auth/Tests/FIRVerifyPhoneNumberRequestTests.m b/Example/Auth/Tests/FIRVerifyPhoneNumberRequestTests.m index 9719d4f..b1ceaf4 100644 --- a/Example/Auth/Tests/FIRVerifyPhoneNumberRequestTests.m +++ b/Example/Auth/Tests/FIRVerifyPhoneNumberRequestTests.m @@ -17,6 +17,7 @@ #import <XCTest/XCTest.h> #import "FIRAuthBackend.h" +#import "FIRAuthOperationType.h" #import "FIRVerifyPhoneNumberRequest.h" #import "FIRVerifyPhoneNumberResponse.h" #import "FIRFakeBackendRPCIssuer.h" @@ -61,6 +62,11 @@ static NSString *const kVerificationIDKey = @"sessionInfo"; */ static NSString *const kIDTokenKey = @"idToken"; +/** @var kOperationKey + @brief The key for the "operation" value in the request. + */ +static NSString *const kOperationKey = @"operation"; + /** @var kTestAccessToken @bried Fake acess token for testing. */ @@ -82,6 +88,22 @@ static NSString *const kPhoneNumberKey = @"phoneNumber"; static NSString *const kExpectedAPIURL = @"https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPhoneNumber?key=APIKey"; +/** @Extension FIRVerifyPhoneNumberRequest + @brief Exposes FIRAuthOperationString from FIRVerifyPhoneNumberRequest to assist testing. + */ +@interface FIRVerifyPhoneNumberRequest () + +/** @fn FIRAuthOperationString + @brief Exposes FIRAuthOperationString from FIRVerifyPhoneNumberRequest to assist testing. + @param operationType The value of the FIRAuthOperationType enum which will be translated to its + corresponding string value. + @return The string value corresponding to the FIRAuthOperationType argument. + + */ +NSString *const FIRAuthOperationString(FIRAuthOperationType operationType); + +@end + /** @class FIRVerifyPhoneNumberRequestTests @brief Tests for @c FIRVerifyPhoneNumberRequest. */ @@ -123,6 +145,7 @@ static NSString *const kExpectedAPIURL = FIRVerifyPhoneNumberRequest *request = [[FIRVerifyPhoneNumberRequest alloc] initWithVerificationID:kVerificationID verificationCode:kVerificationCode + operation:FIRAuthOperationTypeSignUpOrSignIn requestConfiguration:_requestConfiguration]; request.accessToken = kTestAccessToken; [FIRAuthBackend verifyPhoneNumber:request @@ -135,6 +158,8 @@ static NSString *const kExpectedAPIURL = XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kVerificationIDKey], kVerificationID); XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kVerificationCodeKey], kVerificationCode); XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kIDTokenKey], kTestAccessToken); + XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kOperationKey], + FIRAuthOperationString(FIRAuthOperationTypeSignUpOrSignIn)); } /** @fn testVerifyPhoneNumberRequestWithTemporaryProof @@ -144,6 +169,7 @@ static NSString *const kExpectedAPIURL = FIRVerifyPhoneNumberRequest *request = [[FIRVerifyPhoneNumberRequest alloc] initWithTemporaryProof:kTemporaryProof phoneNumber:kPhoneNumber + operation:FIRAuthOperationTypeSignUpOrSignIn requestConfiguration:_requestConfiguration]; request.accessToken = kTestAccessToken; [FIRAuthBackend verifyPhoneNumber:request @@ -156,6 +182,8 @@ static NSString *const kExpectedAPIURL = XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kTemporaryProofKey], kTemporaryProof); XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kPhoneNumberKey], kPhoneNumber); XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kIDTokenKey], kTestAccessToken); + XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kOperationKey], + FIRAuthOperationString(FIRAuthOperationTypeSignUpOrSignIn)); } @end |