Skip to content

Commit

Permalink
silence expectations related swift warning
Browse files Browse the repository at this point in the history
  • Loading branch information
pragatimodi committed Sep 4, 2024
1 parent b9479fa commit a979479
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions FirebaseAuth/Tests/Unit/PhoneAuthProviderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
} catch {
XCTAssertEqual((error as NSError).code, AuthErrorCode.missingPhoneNumber.rawValue)
}
await waitForExpectations(timeout: 5)
await fulfillment(of: [expectation], timeout: 5.0)

This comment has been minimized.

Copy link
@paulb777

paulb777 Sep 4, 2024

Member

Why is there an expectation in this test?

This comment has been minimized.

Copy link
@pragatimodi

pragatimodi Sep 4, 2024

Author Contributor

Looks like it's the expectation that the function call goes through maybe when you run the PhoneAuthProviderTests suite as a whole?

}

/** @fn testVerifyInvalidPhoneNumber
Expand Down Expand Up @@ -553,15 +553,15 @@
forwardingNotification: forwardingNotification)
let auth = try XCTUnwrap(PhoneAuthProviderTests.auth)
let provider = PhoneAuthProvider.provider(auth: auth)
let expectation = self.expectation(description: function)
var expectations = [expectation(description: function)]

if !reCAPTCHAfallback {
// Fake out appCredentialManager flow.
auth.appCredentialManager?.credential = AuthAppCredential(receipt: kTestReceipt,
secret: kTestSecret)
} else {
// 1. Intercept, handle, and test the projectConfiguration RPC calls.
let projectConfigExpectation = self.expectation(description: "projectConfiguration")
let projectConfigExpectation = expectation(description: "projectConfiguration")
rpcIssuer?.projectConfigRequester = { request in
XCTAssertEqual(request.apiKey, PhoneAuthProviderTests.kFakeAPIKey)
projectConfigExpectation.fulfill()
Expand Down Expand Up @@ -591,7 +591,8 @@
)
}
if errorURLString == nil, presenterError == nil {
let requestExpectation = self.expectation(description: "verifyRequester")
let requestExpectation = expectation(description: "verifyRequester")
expectations.append(requestExpectation)
rpcIssuer?.verifyRequester = { request in
XCTAssertEqual(request.phoneNumber, self.kTestPhoneNumber)
switch request.codeIdentity {
Expand Down Expand Up @@ -632,11 +633,11 @@
} catch {
// If an error occurs, assert that verificationID is nil and the error code matches the
// expected value
XCTAssertEqual((error as? NSError)?.code, errorCode)
XCTAssertEqual((error as NSError).code, errorCode)
}
expectation.fulfill()
expectations[0].fulfill()
// Make sure the test waits for expectations to be fulfilled
await waitForExpectations(timeout: 5.0)
await fulfillment(of: expectations, timeout: 5.0)
}

private func initApp(_ functionName: String,
Expand Down

0 comments on commit a979479

Please sign in to comment.