diff options
author | Zsika Phillip <protocol86@users.noreply.github.com> | 2017-06-01 18:12:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-01 18:12:09 -0700 |
commit | 439c29108e60da2f8cc70d8aec7b6ba21e51516d (patch) | |
tree | 840822f4248f1c64ce7d1ecfb042638ddf55b7aa /Example | |
parent | 51ed6b0a4fbdea5db5f57dcdd50e13463d652485 (diff) |
Handle missing email error (#54)
Adds appropriate error handling for missing email in the createUserWithEmail:password:completion: flow.
Also fixes a few typos.
Diffstat (limited to 'Example')
-rw-r--r-- | Example/Auth/Tests/FIRAuthTests.m | 19 | ||||
-rw-r--r-- | Example/Auth/Tests/FIRSignUpNewUserResponseTests.m | 4 |
2 files changed, 21 insertions, 2 deletions
diff --git a/Example/Auth/Tests/FIRAuthTests.m b/Example/Auth/Tests/FIRAuthTests.m index 3a6f717..93d6074 100644 --- a/Example/Auth/Tests/FIRAuthTests.m +++ b/Example/Auth/Tests/FIRAuthTests.m @@ -1200,6 +1200,25 @@ static const NSTimeInterval kWaitInterval = .5; [self waitForExpectationsWithTimeout:kExpectationTimeout handler:nil]; } +/** @fn testCreateUserEmptyEmailFailure + @brief Tests the flow of a failed @c createUserWithEmail:password:completion: call due to an + empty email adress. This error occurs on the client side, so there is no need to fake an RPC + response. + */ +- (void)testCreateUserEmptyEmailFailure { + [self expectGetAccountInfo]; + XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; + [[FIRAuth auth] signOut:NULL]; + [[FIRAuth auth] createUserWithEmail:@"" + password:kPassword + completion:^(FIRUser *_Nullable user, NSError *_Nullable error) { + XCTAssertTrue([NSThread isMainThread]); + XCTAssertEqual(error.code, FIRAuthErrorCodeMissingEmail); + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kExpectationTimeout handler:nil]; +} + /** @fn testSendPasswordResetEmailSuccess @brief Tests the flow of a successful @c sendPasswordResetWithEmail:completion: call. */ diff --git a/Example/Auth/Tests/FIRSignUpNewUserResponseTests.m b/Example/Auth/Tests/FIRSignUpNewUserResponseTests.m index ca4a5f7..ee0c785 100644 --- a/Example/Auth/Tests/FIRSignUpNewUserResponseTests.m +++ b/Example/Auth/Tests/FIRSignUpNewUserResponseTests.m @@ -242,11 +242,11 @@ static const double kAllowedTimeDifference = 0.1; XCTAssertEqual(RPCError.code, FIRAuthErrorCodeOperationNotAllowed); } -/** @fn testinvalidEmailError +/** @fn testInvalidEmailError @brief This test simulates making a request containing an invalid email address and receiving @c FIRAuthErrorInvalidEmail error as a result. */ -- (void)testinvalidEmailError { +- (void)testInvalidEmailError { FIRSignUpNewUserRequest *request = [[FIRSignUpNewUserRequest alloc] initWithAPIKey:kTestAPIKey]; __block BOOL callbackInvoked; |