Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Tests/AsyncDataLoaderTests/DataLoaderAbuseTests.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import XCTest
import Testing

@testable import AsyncDataLoader

/// Provides descriptive error messages for API abuse
class DataLoaderAbuseTests: XCTestCase {
func testFuntionWithNoValues() async throws {
struct DataLoaderAbuseTests {
@Test func funtionWithNoValues() async throws {
let identityLoader = DataLoader<Int, Int>(
options: DataLoaderOptions(batchingEnabled: false)
) { _ in
Expand All @@ -21,10 +21,10 @@ class DataLoaderAbuseTests: XCTestCase {
didFailWithError = error
}

XCTAssertNotNil(didFailWithError)
#expect(didFailWithError != nil)
}

func testBatchFuntionMustPromiseAnArrayOfCorrectLength() async {
@Test func batchFuntionMustPromiseAnArrayOfCorrectLength() async {
let identityLoader = DataLoader<Int, Int> { _ in
[]
}
Expand All @@ -39,10 +39,10 @@ class DataLoaderAbuseTests: XCTestCase {
didFailWithError = error
}

XCTAssertNotNil(didFailWithError)
#expect(didFailWithError != nil)
}

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

Expand All @@ -68,14 +68,14 @@ class DataLoaderAbuseTests: XCTestCase {
didFailWithError = error
}

XCTAssertNotNil(didFailWithError)
#expect(didFailWithError != nil)

let value = try await value1

XCTAssertTrue(value == 1)
#expect(value == 1)
}

func testFuntionWithSomeValues() async throws {
@Test func funtionWithSomeValues() async throws {
let identityLoader = DataLoader<Int, Int>(
options: DataLoaderOptions(batchingEnabled: false)
) { keys in
Expand Down Expand Up @@ -103,11 +103,11 @@ class DataLoaderAbuseTests: XCTestCase {
didFailWithError = error
}

XCTAssertNotNil(didFailWithError)
#expect(didFailWithError != nil)

let value = try await value1

XCTAssertTrue(value == 1)
#expect(value == 1)
}
}

Expand Down
Loading
Loading