Skip to content

Commit 7cbbb33

Browse files
Merge pull request #33 from NeedleInAJayStack/test/swift-testing
Converts to Swift Testing
2 parents c15bdcb + 9a3c76b commit 7cbbb33

5 files changed

Lines changed: 310 additions & 371 deletions

File tree

Tests/AsyncDataLoaderTests/DataLoaderAbuseTests.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import XCTest
1+
import Testing
22

33
@testable import AsyncDataLoader
44

55
/// Provides descriptive error messages for API abuse
6-
class DataLoaderAbuseTests: XCTestCase {
7-
func testFuntionWithNoValues() async throws {
6+
struct DataLoaderAbuseTests {
7+
@Test func funtionWithNoValues() async throws {
88
let identityLoader = DataLoader<Int, Int>(
99
options: DataLoaderOptions(batchingEnabled: false)
1010
) { _ in
@@ -21,10 +21,10 @@ class DataLoaderAbuseTests: XCTestCase {
2121
didFailWithError = error
2222
}
2323

24-
XCTAssertNotNil(didFailWithError)
24+
#expect(didFailWithError != nil)
2525
}
2626

27-
func testBatchFuntionMustPromiseAnArrayOfCorrectLength() async {
27+
@Test func batchFuntionMustPromiseAnArrayOfCorrectLength() async {
2828
let identityLoader = DataLoader<Int, Int> { _ in
2929
[]
3030
}
@@ -39,10 +39,10 @@ class DataLoaderAbuseTests: XCTestCase {
3939
didFailWithError = error
4040
}
4141

42-
XCTAssertNotNil(didFailWithError)
42+
#expect(didFailWithError != nil)
4343
}
4444

45-
func testBatchFuntionWithSomeValues() async throws {
45+
@Test func batchFuntionWithSomeValues() async throws {
4646
let identityLoader = DataLoader<Int, Int> { keys in
4747
var results = [DataLoaderValue<Int>]()
4848

@@ -68,14 +68,14 @@ class DataLoaderAbuseTests: XCTestCase {
6868
didFailWithError = error
6969
}
7070

71-
XCTAssertNotNil(didFailWithError)
71+
#expect(didFailWithError != nil)
7272

7373
let value = try await value1
7474

75-
XCTAssertTrue(value == 1)
75+
#expect(value == 1)
7676
}
7777

78-
func testFuntionWithSomeValues() async throws {
78+
@Test func funtionWithSomeValues() async throws {
7979
let identityLoader = DataLoader<Int, Int>(
8080
options: DataLoaderOptions(batchingEnabled: false)
8181
) { keys in
@@ -103,11 +103,11 @@ class DataLoaderAbuseTests: XCTestCase {
103103
didFailWithError = error
104104
}
105105

106-
XCTAssertNotNil(didFailWithError)
106+
#expect(didFailWithError != nil)
107107

108108
let value = try await value1
109109

110-
XCTAssertTrue(value == 1)
110+
#expect(value == 1)
111111
}
112112
}
113113

0 commit comments

Comments
 (0)