aboutsummaryrefslogtreecommitdiffhomepage
path: root/Example
diff options
context:
space:
mode:
authorGravatar Xiangtian Dai <xiangtian@google.com>2017-08-11 17:12:11 -0700
committerGravatar GitHub <noreply@github.com>2017-08-11 17:12:11 -0700
commit8c3ef6b780d5b9b116c693b3b440dcc7f68b4827 (patch)
tree1c53f866e945324acd7fff5b93e77abb6333d994 /Example
parent6b0739790c637baf2e05b4bc339abb27cfb4f8cb (diff)
Handles MISSING_EMAIL error from server. (#187)
Diffstat (limited to 'Example')
-rw-r--r--Example/Auth/Tests/FIRGetOOBConfirmationCodeResponseTests.m35
1 files changed, 35 insertions, 0 deletions
diff --git a/Example/Auth/Tests/FIRGetOOBConfirmationCodeResponseTests.m b/Example/Auth/Tests/FIRGetOOBConfirmationCodeResponseTests.m
index e722c9d..1cac822 100644
--- a/Example/Auth/Tests/FIRGetOOBConfirmationCodeResponseTests.m
+++ b/Example/Auth/Tests/FIRGetOOBConfirmationCodeResponseTests.m
@@ -53,6 +53,11 @@ static NSString *const kTestOOBCode = @"OOBCode";
*/
static NSString *const kEmailNotFoundMessage = @"EMAIL_NOT_FOUND: fake custom message";
+/** @var kMissingEmailErrorMessage
+ @brief The value of the "message" field returned for a "missing email" error.
+ */
+static NSString *const kMissingEmailErrorMessage = @"MISSING_EMAIL";
+
/** @var kInvalidEmailErrorMessage
@brief The error returned by the server if the email is invalid.
*/
@@ -234,6 +239,36 @@ static NSString *const kIosBundleID = @"testBundleID";
XCTAssertNil(RPCResponse);
}
+/** @fn testMissingEmailError
+ @brief This test checks for missing email responses, and makes sure they are decoded to the
+ correct error response.
+ */
+- (void)testMissingEmailError {
+ FIRGetOOBConfirmationCodeRequest *request = [FIRGetOOBConfirmationCodeRequest
+ verifyEmailRequestWithAccessToken:kTestAccessToken
+ actionCodeSettings:[self fakeActionCodeSettings]
+ requestConfiguration:_requestConfiguration];
+
+ __block BOOL callbackInvoked;
+ __block FIRGetOOBConfirmationCodeResponse *RPCResponse;
+ __block NSError *RPCError;
+ [FIRAuthBackend getOOBConfirmationCode:request
+ callback:^(FIRGetOOBConfirmationCodeResponse *_Nullable response,
+ NSError *_Nullable error) {
+ callbackInvoked = YES;
+ RPCResponse = response;
+ RPCError = error;
+ }];
+
+ [_RPCIssuer respondWithServerErrorMessage:kMissingEmailErrorMessage];
+
+ XCTAssert(callbackInvoked);
+ XCTAssertNotNil(RPCError);
+ XCTAssertEqualObjects(RPCError.domain, FIRAuthErrorDomain);
+ XCTAssertEqual(RPCError.code, FIRAuthErrorCodeMissingEmail);
+ XCTAssertNil(RPCResponse);
+}
+
/** @fn testInvalidEmailError
@brief This test checks for the INVALID_EMAIL error message from the backend.
*/