Skip to content

Commit 07b4e1e

Browse files
Adopt real fulfillment API
1 parent 7c0532b commit 07b4e1e

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

Tests/OAuthenticatorTests/AuthenticatorTests.swift

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,6 @@ final class AuthenticatorTests: XCTestCase {
4949
throw AuthenticatorTestsError.disabled
5050
}
5151

52-
private func compatFulfillment(of expectations: [XCTestExpectation], timeout: TimeInterval, enforceOrder: Bool) async {
53-
#if compiler(>=5.8)
54-
await fulfillment(of: expectations, timeout: timeout, enforceOrder: enforceOrder)
55-
#else
56-
await Task {
57-
wait(for: expectations, timeout: timeout, enforceOrder: enforceOrder)
58-
}.value
59-
#endif
60-
}
61-
6252
@MainActor
6353
func testInitialLogin() async throws {
6454
let authedLoadExp = expectation(description: "load url")
@@ -115,7 +105,7 @@ final class AuthenticatorTests: XCTestCase {
115105

116106
let (_, _) = try await auth.response(for: URLRequest(url: URL(string: "https://example.com")!))
117107

118-
await compatFulfillment(of: [retrieveTokenExp, userAuthExp, storeTokenExp, authedLoadExp], timeout: 1.0, enforceOrder: true)
108+
await fulfillment(of: [retrieveTokenExp, userAuthExp, storeTokenExp, authedLoadExp], timeout: 1.0, enforceOrder: true)
119109
}
120110

121111
@MainActor
@@ -151,7 +141,7 @@ final class AuthenticatorTests: XCTestCase {
151141

152142
let (_, _) = try await auth.response(for: URLRequest(url: URL(string: "https://example.com")!))
153143

154-
await compatFulfillment(of: [retrieveTokenExp, authedLoadExp], timeout: 1.0, enforceOrder: true)
144+
await fulfillment(of: [retrieveTokenExp, authedLoadExp], timeout: 1.0, enforceOrder: true)
155145
}
156146

157147
@MainActor
@@ -203,7 +193,7 @@ final class AuthenticatorTests: XCTestCase {
203193

204194
let (_, _) = try await auth.response(for: URLRequest(url: URL(string: "https://example.com")!))
205195

206-
await compatFulfillment(of: [retrieveTokenExp, refreshExp, storeTokenExp, authedLoadExp], timeout: 1.0, enforceOrder: true)
196+
await fulfillment(of: [retrieveTokenExp, refreshExp, storeTokenExp, authedLoadExp], timeout: 1.0, enforceOrder: true)
207197
}
208198

209199
@MainActor
@@ -258,7 +248,7 @@ final class AuthenticatorTests: XCTestCase {
258248

259249
let (_, _) = try await auth.response(for: URLRequest(url: URL(string: "https://example.com")!))
260250

261-
await compatFulfillment(of: [userAuthExp, loadExp], timeout: 1.0, enforceOrder: true)
251+
await fulfillment(of: [userAuthExp, loadExp], timeout: 1.0, enforceOrder: true)
262252
}
263253

264254
@MainActor
@@ -319,7 +309,7 @@ final class AuthenticatorTests: XCTestCase {
319309

320310
let (_, _) = try await auth.response(for: URLRequest(url: URL(string: "https://example.com")!))
321311

322-
await compatFulfillment(of: [userAuthExp, loadExp], timeout: 1.0, enforceOrder: true)
312+
await fulfillment(of: [userAuthExp, loadExp], timeout: 1.0, enforceOrder: true)
323313
}
324314

325315
// Test AuthenticationResultHandler with a failed UserAuthenticator
@@ -374,7 +364,7 @@ final class AuthenticatorTests: XCTestCase {
374364
throw error
375365
}
376366

377-
await compatFulfillment(of: [failureAuth], timeout: 1.0, enforceOrder: true)
367+
await fulfillment(of: [failureAuth], timeout: 1.0, enforceOrder: true)
378368
}
379369

380370
@MainActor

0 commit comments

Comments
 (0)