Skip to content

Commit 78b9503

Browse files
committed
Update tests
1 parent 8eff91d commit 78b9503

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Sources/App/Core/Dependencies/CurrentReferenceCacheClient.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,12 @@ extension CurrentReferenceCacheClient {
110110
}
111111
}
112112
}
113+
114+
115+
#if DEBUG
116+
extension CurrentReferenceCacheClient {
117+
static var disabled: Self {
118+
.init(set: { _, _, _ in }, get: { _, _ in nil })
119+
}
120+
}
121+
#endif

Tests/AppTests/PackageController+routesTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@ class PackageController_routesTests: SnapshotTestCase {
14791479
// Ensures default branch updates don't introduce a "documentation gap"
14801480
// https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/2288
14811481
try await withDependencies {
1482+
$0.currentReferenceCache = .disabled
14821483
$0.environment.awsDocsBucket = { "docs-bucket" }
14831484
$0.environment.currentReferenceCache = { .live }
14841485
$0.httpClient.fetchDocumentation = { @Sendable _ in .init(status: .ok, body: .mockIndexHTML()) }
@@ -1558,6 +1559,7 @@ class PackageController_routesTests: SnapshotTestCase {
15581559
func test_getDocRoute_documentation_current() async throws {
15591560
nonisolated(unsafe) let cache = CurrentReferenceCache()
15601561
try await withDependencies {
1562+
$0.currentReferenceCache = .disabled
15611563
$0.environment.currentReferenceCache = { cache }
15621564
} operation: {
15631565
// owner/repo/~/documentation/archive

0 commit comments

Comments
 (0)