FirebaseFacebookAuthUI/FirebaseFacebookAuthUITests/FirebaseFacebookAuthUITests.m [90:138]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  NSString *testToken = @"fakeToken";
  XCTAssertNotNil(self.provider);
  XCTAssertNil(self.provider.accessToken);

  FBSDKAccessToken *token = [[FBSDKAccessToken alloc] initWithTokenString:testToken
                                                              permissions:@[]
                                                      declinedPermissions:@[]
                                                       expiredPermissions:@[]
                                                                    appID:@"testAppId"
                                                                   userID:@"testUserId"
                                                           expirationDate:nil
                                                              refreshDate:nil
                                                 dataAccessExpirationDate:nil];
  id mockToken = OCMPartialMock(token);

  NSSet *emptySet = [NSSet set];
  FBSDKLoginManagerLoginResult *result =
      [[FBSDKLoginManagerLoginResult alloc] initWithToken:mockToken
                                      authenticationToken:nil
                                              isCancelled:NO
                                       grantedPermissions:emptySet
                                      declinedPermissions:emptySet];
  XCTAssertNil(_provider.accessToken);
  [self.provider configureLoginManager:result withError:nil];

  XCTestExpectation *expectation = [self expectationWithDescription:@"logged in"];
  [self.provider signInWithDefaultValue:nil
               presentingViewController:nil
                             completion:^(FIRAuthCredential *_Nullable credential,
                                          NSError *_Nullable error,
                                          FIRAuthResultCallback _Nullable result,
                                          NSDictionary *_Nullable userInfo) {
    XCTAssertNil(error);
    XCTAssertNotNil(credential);
    XCTAssertNotNil(result);
    FIRAuthCredential *expectedCredential = [FIRFacebookAuthProvider credentialWithAccessToken:testToken];
    XCTAssertEqualObjects(credential.provider, expectedCredential.provider);
    XCTAssertNil(self.provider.idToken);

    //verify that we are using token from server
    OCMVerify([mockToken tokenString]);

    [expectation fulfill];
  }];
  [self waitForExpectationsWithTimeout:0.1 handler:^(NSError *_Nullable error) {
    XCTAssertNil(error);
  }];

  OCMVerify(never(), [self.mockOAuthProvider getCredentialWithUIDelegate:nil completion:OCMOCK_ANY]);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



FirebaseFacebookAuthUI/FirebaseFacebookAuthUITests/FirebaseFacebookAuthUITests.m [146:194]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  NSString *testToken = @"fakeToken";
  XCTAssertNotNil(self.provider);
  XCTAssertNil(self.provider.accessToken);

  FBSDKAccessToken *token = [[FBSDKAccessToken alloc] initWithTokenString:testToken
                                                              permissions:@[]
                                                      declinedPermissions:@[]
                                                       expiredPermissions:@[]
                                                                    appID:@"testAppId"
                                                                   userID:@"testUserId"
                                                           expirationDate:nil
                                                              refreshDate:nil
                                                 dataAccessExpirationDate:nil];
  id mockToken = OCMPartialMock(token);

  NSSet *emptySet = [NSSet set];
  FBSDKLoginManagerLoginResult *result =
      [[FBSDKLoginManagerLoginResult alloc] initWithToken:mockToken
                                      authenticationToken:nil
                                              isCancelled:NO
                                       grantedPermissions:emptySet
                                      declinedPermissions:emptySet];
  XCTAssertNil(_provider.accessToken);
  [self.provider configureLoginManager:result withError:nil];

  XCTestExpectation *expectation = [self expectationWithDescription:@"logged in"];
  [self.provider signInWithDefaultValue:nil
               presentingViewController:nil
                             completion:^(FIRAuthCredential *_Nullable credential,
                                          NSError *_Nullable error,
                                          FIRAuthResultCallback _Nullable result,
                                          NSDictionary *_Nullable userInfo) {
    XCTAssertNil(error);
    XCTAssertNotNil(credential);
    XCTAssertNotNil(result);
    FIRAuthCredential *expectedCredential = [FIRFacebookAuthProvider credentialWithAccessToken:testToken];
    XCTAssertEqualObjects(credential.provider, expectedCredential.provider);
    XCTAssertNil(self.provider.idToken);

    //verify that we are using token from server
    OCMVerify([mockToken tokenString]);

    [expectation fulfill];
  }];
  [self waitForExpectationsWithTimeout:0.1 handler:^(NSError *_Nullable error) {
    XCTAssertNil(error);
  }];

  OCMVerify(never(), [self.mockOAuthProvider getCredentialWithUIDelegate:nil completion:OCMOCK_ANY]);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



