Skip to content

Commit 9afb942

Browse files
committed
Fix tests
1 parent 5136257 commit 9afb942

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

Tests/AppTests/MastodonTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ final class MastodonTests: AppTestCase {
5858

5959
try await withDependencies {
6060
$0.date.now = .now
61+
$0.packageListRepository.fetchCustomCollections = { @Sendable _ in [] }
62+
$0.packageListRepository.fetchCustomCollection = { @Sendable _, _ in [] }
6163
} operation: {
6264
// run first two processing steps
6365
try await reconcile(client: app.client, database: app.db)

Tests/AppTests/MetricsTests.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
@testable import App
1616

17+
import Dependencies
1718
import Prometheus
1819
import XCTest
1920

@@ -98,14 +99,18 @@ class MetricsTests: AppTestCase {
9899
}
99100

100101
func test_reconcileDurationSeconds() async throws {
101-
// setup
102-
Current.fetchPackageList = { _ in ["1", "2", "3"].asURLs }
102+
try await withDependencies {
103+
$0.packageListRepository.fetchCustomCollections = { @Sendable _ in [] }
104+
} operation: {
105+
// setup
106+
Current.fetchPackageList = { _ in ["1", "2", "3"].asURLs }
103107

104-
// MUT
105-
try await reconcile(client: app.client, database: app.db)
108+
// MUT
109+
try await reconcile(client: app.client, database: app.db)
106110

107-
// validation
108-
XCTAssert((AppMetrics.reconcileDurationSeconds?.get()) ?? 0 > 0)
111+
// validation
112+
XCTAssert((AppMetrics.reconcileDurationSeconds?.get()) ?? 0 > 0)
113+
}
109114
}
110115

111116
func test_ingestDurationSeconds() async throws {

Tests/AppTests/PackageTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ final class PackageTests: AppTestCase {
297297
func test_isNew() async throws {
298298
try await withDependencies {
299299
$0.date.now = .now
300+
$0.packageListRepository.fetchCustomCollections = { @Sendable _ in [] }
300301
} operation: {
301302
// setup
302303
let url = "1".asGithubUrl

Tests/AppTests/PipelineTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ class PipelineTests: AppTestCase {
160160
func test_processing_pipeline() async throws {
161161
try await withDependencies {
162162
$0.date.now = .now
163+
$0.packageListRepository.fetchCustomCollections = { @Sendable _ in [] }
164+
$0.packageListRepository.fetchCustomCollection = { @Sendable _, _ in [] }
163165
} operation: {
164166
// Test pipeline pick-up end to end
165167
// setup

0 commit comments

Comments
 (0)