@@ -566,8 +566,8 @@ class PackageController_routesTests: SnapshotTestCase {
566566 // Test the current (~) documentation routes:
567567 // /owner/package/documentation/~ + various path elements
568568 try await withDependencies {
569+ $0. currentReferenceCache = . disabled
569570 $0. environment. awsDocsBucket = { " docs-bucket " }
570- $0. environment. currentReferenceCache = { nil }
571571 $0. httpClient. fetchDocumentation = { @Sendable _ in . init( status: . ok, body: . mockIndexHTML( ) ) }
572572 } operation: {
573573 // setup
@@ -649,8 +649,8 @@ class PackageController_routesTests: SnapshotTestCase {
649649 // Test the current (~) documentation routes with baseURL rewriting:
650650 // /owner/package/documentation/~ + various path elements
651651 try await withDependencies {
652+ $0. currentReferenceCache = . disabled
652653 $0. environment. awsDocsBucket = { " docs-bucket " }
653- $0. environment. currentReferenceCache = { nil }
654654 $0. httpClient. fetchDocumentation = { @Sendable _ in . init( status: . ok, body: . mockIndexHTML( baseURL: " /owner/package/1.0.0 " ) ) }
655655 } operation: {
656656 // setup
@@ -941,8 +941,8 @@ class PackageController_routesTests: SnapshotTestCase {
941941
942942 func test_documentation_current_css( ) async throws {
943943 try await withDependencies {
944+ $0. currentReferenceCache = . disabled
944945 $0. environment. awsDocsBucket = { " docs-bucket " }
945- $0. environment. currentReferenceCache = { nil }
946946 $0. httpClient. fetchDocumentation = App . HTTPClient. echoURL ( )
947947 } operation: {
948948 // setup
@@ -996,8 +996,8 @@ class PackageController_routesTests: SnapshotTestCase {
996996
997997 func test_documentation_current_js( ) async throws {
998998 try await withDependencies {
999+ $0. currentReferenceCache = . disabled
9991000 $0. environment. awsDocsBucket = { " docs-bucket " }
1000- $0. environment. currentReferenceCache = { nil }
10011001 $0. httpClient. fetchDocumentation = App . HTTPClient. echoURL ( )
10021002 } operation: {
10031003 // setup
@@ -1051,8 +1051,8 @@ class PackageController_routesTests: SnapshotTestCase {
10511051
10521052 func test_documentation_current_data( ) async throws {
10531053 try await withDependencies {
1054+ $0. currentReferenceCache = . disabled
10541055 $0. environment. awsDocsBucket = { " docs-bucket " }
1055- $0. environment. currentReferenceCache = { nil }
10561056 $0. httpClient. fetchDocumentation = App . HTTPClient. echoURL ( )
10571057 } operation: {
10581058 // setup
@@ -1156,8 +1156,8 @@ class PackageController_routesTests: SnapshotTestCase {
11561156 // https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/2287
11571157 // Ensure references are path encoded
11581158 try await withDependencies {
1159+ $0. currentReferenceCache = . disabled
11591160 $0. environment. awsDocsBucket = { " docs-bucket " }
1160- $0. environment. currentReferenceCache = { nil }
11611161 $0. httpClient. fetchDocumentation = { @Sendable _ in . init( status: . ok, body: . mockIndexHTML( ) ) }
11621162 } operation: {
11631163 // setup
@@ -1220,8 +1220,8 @@ class PackageController_routesTests: SnapshotTestCase {
12201220
12211221 func test_documentation_routes_tutorials( ) async throws {
12221222 try await withDependencies {
1223+ $0. currentReferenceCache = . disabled
12231224 $0. environment. awsDocsBucket = { " docs-bucket " }
1224- $0. environment. currentReferenceCache = { nil }
12251225 $0. environment. dbId = { nil }
12261226 $0. httpClient. fetchDocumentation = { @Sendable _ in . init( status: . ok, body: . mockIndexHTML( ) ) }
12271227 } operation: {
@@ -1481,7 +1481,6 @@ class PackageController_routesTests: SnapshotTestCase {
14811481 try await withDependencies {
14821482 $0. currentReferenceCache = . disabled
14831483 $0. environment. awsDocsBucket = { " docs-bucket " }
1484- $0. environment. currentReferenceCache = { . live }
14851484 $0. httpClient. fetchDocumentation = { @Sendable _ in . init( status: . ok, body: . mockIndexHTML( ) ) }
14861485 } operation: {
14871486 // setup
@@ -1557,10 +1556,8 @@ class PackageController_routesTests: SnapshotTestCase {
15571556 }
15581557
15591558 func test_getDocRoute_documentation_current( ) async throws {
1560- nonisolated ( unsafe) let cache = CurrentReferenceCache ( )
15611559 try await withDependencies {
1562- $0. currentReferenceCache = . disabled
1563- $0. environment. currentReferenceCache = { cache }
1560+ $0. currentReferenceCache = . inMemory
15641561 } operation: {
15651562 // owner/repo/~/documentation/archive
15661563 let req = Request ( application: app, url: " " , on: app. eventLoopGroup. next ( ) )
@@ -1578,6 +1575,7 @@ class PackageController_routesTests: SnapshotTestCase {
15781575 XCTFail ( " unexpected error: \( error) " )
15791576 }
15801577
1578+ @Dependency ( \. currentReferenceCache) var cache
15811579 await cache. set ( owner: " owner " , repository: " repo " , reference: " 1.2.3 " )
15821580
15831581 do { // Now with the cache in place this resolves
0 commit comments