Skip to content

Commit

Permalink
another failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrandonw committed Nov 4, 2024
1 parent 112c28a commit be8865c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Tests/DependenciesTests/DependencyValuesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,14 @@ final class DependencyValuesTests: XCTestCase {
XCTAssertEqual(now, Date(timeIntervalSinceReferenceDate: 1))
}

func testPrepareDependencies_setDependencyEndpoint() {
prepareDependencies {
$0[ClientWithEndpoint.self].get = { @Sendable in 42 }
}
@Dependency(ClientWithEndpoint.self) var client
XCTAssertEqual(client.get(), 42)
}

#if DEBUG && !os(Linux) && !os(WASI) && !os(Windows)
func testPrepareDependencies_alreadyCached() {
withDependencies {
Expand Down Expand Up @@ -903,3 +911,10 @@ extension DependencyValues {
set { self[FullDependency.self] = newValue }
}
}

private struct ClientWithEndpoint: TestDependencyKey {
var get: @Sendable () -> Int
static var testValue: ClientWithEndpoint {
Self { 42 }
}
}

0 comments on commit be8865c

Please sign in to comment.