diff options
Diffstat (limited to 'Example/Auth/Tests')
-rw-r--r-- | Example/Auth/Tests/FIRAuthTests.m | 21 | ||||
-rw-r--r-- | Example/Auth/Tests/FIRPhoneAuthProviderTests.m | 3 | ||||
-rw-r--r-- | Example/Auth/Tests/FIRUserTests.m | 4 |
3 files changed, 15 insertions, 13 deletions
diff --git a/Example/Auth/Tests/FIRAuthTests.m b/Example/Auth/Tests/FIRAuthTests.m index 34c0499..8859cb3 100644 --- a/Example/Auth/Tests/FIRAuthTests.m +++ b/Example/Auth/Tests/FIRAuthTests.m @@ -1863,16 +1863,17 @@ static const NSTimeInterval kWaitInterval = .5; [self waitForSignInWithAccessToken:kTestAccessToken APIKey:kTestAPIKey completion:nil]; - NSString *kTestAPIKey2 = @"fakeAPIKey2"; - FIRUser *user2 = [FIRAuth auth].currentUser; - user2.requestConfiguration = [[FIRAuthRequestConfiguration alloc]initWithAPIKey:kTestAPIKey2]; - OCMExpect([_mockBackend getAccountInfo:[OCMArg any] callback:[OCMArg any]]) - .andDispatchError2([FIRAuthErrorUtils networkErrorWithUnderlyingError:[NSError new]]); - XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; - [[FIRAuth auth] updateCurrentUser:user2 completion:^(NSError *_Nullable error) { - XCTAssertEqual(error.code, FIRAuthErrorCodeNetworkError); - [expectation fulfill]; - }]; + NSString *kTestAPIKey2 = @"fakeAPIKey2"; + FIRUser *user2 = [FIRAuth auth].currentUser; + user2.requestConfiguration = [[FIRAuthRequestConfiguration alloc]initWithAPIKey:kTestAPIKey2]; + NSError *underlyingError = [NSError errorWithDomain:@"Test Error" code:1 userInfo:nil]; + OCMExpect([_mockBackend getAccountInfo:[OCMArg any] callback:[OCMArg any]]) + .andDispatchError2([FIRAuthErrorUtils networkErrorWithUnderlyingError:underlyingError]); + XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; + [[FIRAuth auth] updateCurrentUser:user2 completion:^(NSError *_Nullable error) { + XCTAssertEqual(error.code, FIRAuthErrorCodeNetworkError); + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kExpectationTimeout handler:nil]; OCMVerifyAll(_mockBackend); } diff --git a/Example/Auth/Tests/FIRPhoneAuthProviderTests.m b/Example/Auth/Tests/FIRPhoneAuthProviderTests.m index 1bb42b1..6c925a5 100644 --- a/Example/Auth/Tests/FIRPhoneAuthProviderTests.m +++ b/Example/Auth/Tests/FIRPhoneAuthProviderTests.m @@ -453,7 +453,8 @@ static const NSTimeInterval kExpectationTimeout = 2; // Assert that the app credential is nil when in test mode. XCTAssertNil(request.appCredential); dispatch_async(FIRAuthGlobalWorkQueue(), ^() { - callback(nil, [FIRAuthErrorUtils networkErrorWithUnderlyingError:[NSError new]]); + NSError *underlying = [NSError errorWithDomain:@"Test Error" code:1 userInfo:nil]; + callback(nil, [FIRAuthErrorUtils networkErrorWithUnderlyingError:underlying]); }); }); diff --git a/Example/Auth/Tests/FIRUserTests.m b/Example/Auth/Tests/FIRUserTests.m index 8bb6786..957fd24 100644 --- a/Example/Auth/Tests/FIRUserTests.m +++ b/Example/Auth/Tests/FIRUserTests.m @@ -1151,8 +1151,8 @@ static const NSTimeInterval kExpectationTimeout = 2; XCTAssertEqualObjects(request.APIKey, kAPIKey); dispatch_async(FIRAuthGlobalWorkQueue(), ^() { - - callback(nil, [FIRAuthErrorUtils networkErrorWithUnderlyingError:[NSError new]]); + NSError *underlying = [NSError errorWithDomain:@"Test Error" code:1 userInfo:nil]; + callback(nil, [FIRAuthErrorUtils networkErrorWithUnderlyingError:underlying]); }); }); [user getIDTokenResultForcingRefresh:YES |