Skip to content

Commit

Permalink
Auth Unit Test Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 committed Dec 6, 2024
1 parent 424c02b commit 1da9605
Show file tree
Hide file tree
Showing 28 changed files with 378 additions and 380 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ import Foundation
)
}

return try await withCheckedThrowingContinuation { continuation in
return try await withUnsafeThrowingContinuation { continuation in
self.auth.authURLPresenter.present(url,
uiDelegate: uiDelegate,
callbackMatcher: callbackMatcher) { callbackURL, error in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
}

func getToken() async throws -> AuthAPNSToken {
return try await withCheckedThrowingContinuation { continuation in
return try await withUnsafeThrowingContinuation { continuation in
self.getTokenInternal { result in
switch result {
case let .success(token):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

func didStartVerification(withReceipt receipt: String,
timeout: TimeInterval) async -> AuthAppCredential {
return await withCheckedContinuation { continuation in
return await withUnsafeContinuation { continuation in
self.didStartVerificationInternal(withReceipt: receipt, timeout: timeout) { credential in
continuation.resume(returning: credential)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
}

func checkNotificationForwarding() async -> Bool {
return await withCheckedContinuation { continuation in
return await withUnsafeContinuation { continuation in
checkNotificationForwardingInternal { value in
continuation.resume(returning: value)
}
Expand Down
18 changes: 9 additions & 9 deletions FirebaseAuth/Tests/Unit/AuthBackendTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class AuthBackendTests: RPCBaseTests {
let request = FakeRequest(withRequestBody: [:])
rpcIssuer.respondBlock = {
let responseError = NSError(domain: self.kFakeErrorDomain, code: self.kFakeErrorCode)
try self.rpcIssuer.respond(withData: nil, error: responseError)
return (nil, responseError)
}
do {
let _ = try await authBackend.call(with: request)
Expand Down Expand Up @@ -122,7 +122,7 @@ class AuthBackendTests: RPCBaseTests {
let request = FakeRequest(withRequestBody: [:])
rpcIssuer.respondBlock = {
let responseError = NSError(domain: self.kFakeErrorDomain, code: self.kFakeErrorCode)
try self.rpcIssuer.respond(withData: data, error: responseError)
return (data, error: responseError)
}
do {
let _ = try await authBackend.call(with: request)
Expand Down Expand Up @@ -159,7 +159,7 @@ class AuthBackendTests: RPCBaseTests {
let data = "<xml>Some non-JSON value.</xml>".data(using: .utf8)
let request = FakeRequest(withRequestBody: [:])
rpcIssuer.respondBlock = {
try self.rpcIssuer.respond(withData: data, error: nil)
(data, nil)
}
do {
let _ = try await authBackend.call(with: request)
Expand Down Expand Up @@ -201,7 +201,7 @@ class AuthBackendTests: RPCBaseTests {
let responseError = NSError(domain: kFakeErrorDomain, code: kFakeErrorCode)
let request = FakeRequest(withRequestBody: [:])
rpcIssuer.respondBlock = {
try self.rpcIssuer.respond(withData: data, error: responseError)
(data, responseError)
}
do {
let _ = try await authBackend.call(with: request)
Expand Down Expand Up @@ -243,7 +243,7 @@ class AuthBackendTests: RPCBaseTests {
let data = "[]".data(using: .utf8)
let request = FakeRequest(withRequestBody: [:])
rpcIssuer.respondBlock = {
try self.rpcIssuer.respond(withData: data, error: nil)
(data, nil)
}
do {
let _ = try await authBackend.call(with: request)
Expand Down Expand Up @@ -277,8 +277,8 @@ class AuthBackendTests: RPCBaseTests {
let request = FakeRequest(withRequestBody: [:])
rpcIssuer.respondBlock = {
let responseError = NSError(domain: self.kFakeErrorDomain, code: self.kFakeErrorCode)
try self.rpcIssuer.respond(serverErrorMessage: kErrorMessageCaptchaRequired,
error: responseError)
return try self.rpcIssuer.respond(serverErrorMessage: kErrorMessageCaptchaRequired,
error: responseError)
}
do {
let _ = try await authBackend.call(with: request)
Expand Down Expand Up @@ -317,7 +317,7 @@ class AuthBackendTests: RPCBaseTests {
let request = FakeRequest(withRequestBody: [:])
rpcIssuer.respondBlock = {
let responseError = NSError(domain: self.kFakeErrorDomain, code: self.kFakeErrorCode)
try self.rpcIssuer.respond(
return try self.rpcIssuer.respond(
serverErrorMessage: kErrorMessageCaptchaCheckFailed,
error: responseError
)
Expand Down Expand Up @@ -427,7 +427,7 @@ class AuthBackendTests: RPCBaseTests {
let request = FakeRequest(withRequestBody: [:])
let responseError = NSError(domain: kFakeErrorDomain, code: kFakeErrorCode)
rpcIssuer.respondBlock = {
let _ = try self.rpcIssuer.respond(withJSON: [:], error: responseError)
try self.rpcIssuer.respond(withJSON: [:], error: responseError)
}
do {
let _ = try await authBackend.call(with: request)
Expand Down
Loading

0 comments on commit 1da9605

Please sign in to comment.