@@ -56,6 +56,7 @@ class AnalyzerTests: AppTestCase {
5656 if path. hasSuffix ( " Package.resolved " ) { return true }
5757 return false
5858 }
59+ $0. git = . liveValue
5960 $0. httpClient. mastodonPost = { @Sendable _ in }
6061 } operation: {
6162 // setup
@@ -221,6 +222,7 @@ class AnalyzerTests: AppTestCase {
221222 $0. environment. allowSocialPosts = { true }
222223 $0. environment. loadSPIManifest = { _ in nil }
223224 $0. fileManager. fileExists = { @Sendable _ in true }
225+ $0. git. commitCount = { @Sendable _ in 12 }
224226 $0. httpClient. mastodonPost = { @Sendable _ in }
225227 } operation: {
226228 // setup
@@ -245,7 +247,6 @@ class AnalyzerTests: AppTestCase {
245247 packageName: " foo-1 " ,
246248 reference: . tag( 1 , 0 , 0 ) ) . save ( on: app. db)
247249
248- Current . git. commitCount = { @Sendable _ in 12 }
249250 Current . git. firstCommitDate = { @Sendable _ in . t0 }
250251 Current . git. lastCommitDate = { @Sendable _ in . t2 }
251252 Current . git. getTags = { @Sendable _ in [ . tag( 1 , 0 , 0 ) , . tag( 1 , 1 , 1 ) ] }
@@ -315,14 +316,14 @@ class AnalyzerTests: AppTestCase {
315316 try await withDependencies {
316317 $0. date. now = . now
317318 $0. fileManager. fileExists = { @Sendable _ in true }
319+ $0. git. commitCount = { @Sendable _ in 12 }
318320 } operation: {
319321 // setup
320322 do {
321323 let pkg = try await savePackage ( on: app. db, " https://github.com/foo/1 " , processingStage: . ingestion)
322324 try await Repository ( package : pkg, defaultBranch: " main " ) . save ( on: app. db)
323325 }
324326
325- Current . git. commitCount = { @Sendable _ in 12 }
326327 Current . git. firstCommitDate = { @Sendable _ in . t0 }
327328 Current . git. lastCommitDate = { @Sendable _ in . t1 }
328329 Current . git. hasBranch = { @Sendable _, _ in false } // simulate analysis error via branch mismatch
@@ -360,6 +361,7 @@ class AnalyzerTests: AppTestCase {
360361 $0. environment. allowSocialPosts = { true }
361362 $0. environment. loadSPIManifest = { _ in nil }
362363 $0. fileManager. fileExists = { @Sendable _ in true }
364+ $0. git. commitCount = { @Sendable _ in 12 }
363365 } operation: {
364366 // setup
365367 let urls = [ " https://github.com/foo/1 " , " https://github.com/foo/2 " ]
@@ -369,7 +371,6 @@ class AnalyzerTests: AppTestCase {
369371 }
370372 let lastUpdate = Date ( )
371373
372- Current . git. commitCount = { @Sendable _ in 12 }
373374 Current . git. firstCommitDate = { @Sendable _ in . t0 }
374375 Current . git. lastCommitDate = { @Sendable _ in . t1 }
375376 Current . git. getTags = { @Sendable _ in [ . tag( 1 , 0 , 0 ) ] }
@@ -418,6 +419,7 @@ class AnalyzerTests: AppTestCase {
418419 if path. hasSuffix ( " Package.swift " ) { return true }
419420 return false
420421 }
422+ $0. git = . liveValue
421423 } operation: {
422424 // setup
423425 let urls = [ " https://github.com/foo/1 " , " https://github.com/foo/2 " ]
@@ -521,9 +523,9 @@ class AnalyzerTests: AppTestCase {
521523 func test_updateRepository( ) async throws {
522524 try await withDependencies {
523525 $0. fileManager. fileExists = { @Sendable _ in true }
526+ $0. git. commitCount = { @Sendable _ in 12 }
524527 } operation: {
525528 // setup
526- Current . git. commitCount = { @Sendable _ in 12 }
527529 Current . git. firstCommitDate = { @Sendable _ in . t0 }
528530 Current . git. lastCommitDate = { @Sendable _ in . t1 }
529531 Current . git. shortlog = { @Sendable _ in
@@ -894,9 +896,9 @@ class AnalyzerTests: AppTestCase {
894896 $0. environment. allowSocialPosts = { true }
895897 $0. environment. loadSPIManifest = { _ in nil }
896898 $0. fileManager. fileExists = { @Sendable _ in true }
899+ $0. git. commitCount = { @Sendable _ in 12 }
897900 } operation: {
898901 // setup
899- Current . git. commitCount = { @Sendable _ in 12 }
900902 Current . git. firstCommitDate = { @Sendable _ in . t0 }
901903 Current . git. lastCommitDate = { @Sendable _ in . t1 }
902904 Current . git. getTags = { @Sendable _ in [ . tag( 1 , 0 , 0 ) , . tag( 2 , 0 , 0 ) ] }
@@ -1300,6 +1302,7 @@ class AnalyzerTests: AppTestCase {
13001302 // https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/2571
13011303 try await withDependencies {
13021304 $0. fileManager. fileExists = { @Sendable _ in true }
1305+ $0. git. commitCount = { @Sendable _ in 2 }
13031306 } operation: {
13041307 let pkgId = UUID ( )
13051308 let pkg = Package ( id: pkgId, url: " 1 " . asGithubUrl. url, processingStage: . ingestion)
@@ -1320,7 +1323,6 @@ class AnalyzerTests: AppTestCase {
13201323 latest: . release,
13211324 packageName: " foo-1 " ,
13221325 reference: . tag( 1 , 0 , 0 ) ) . save ( on: app. db)
1323- Current . git. commitCount = { @Sendable _ in 2 }
13241326 Current . git. firstCommitDate = { @Sendable _ in . t0 }
13251327 Current . git. hasBranch = { @Sendable _, _ in true }
13261328 Current . git. lastCommitDate = { @Sendable _ in . t1 }
@@ -1406,6 +1408,7 @@ class AnalyzerTests: AppTestCase {
14061408 try await withDependencies {
14071409 $0. date. now = . now
14081410 $0. fileManager. fileExists = { @Sendable _ in true }
1411+ $0. git. commitCount = { @Sendable _ in 2 }
14091412 } operation: {
14101413 let pkgId = UUID ( )
14111414 let pkg = Package ( id: pkgId, url: " 1 " . asGithubUrl. url, processingStage: . ingestion)
@@ -1426,7 +1429,6 @@ class AnalyzerTests: AppTestCase {
14261429 latest: . release,
14271430 packageName: " foo-1 " ,
14281431 reference: . tag( 1 , 0 , 0 ) ) . save ( on: app. db)
1429- Current . git. commitCount = { @Sendable _ in 2 }
14301432 Current . git. firstCommitDate = { @Sendable _ in . t0 }
14311433 Current . git. hasBranch = { @Sendable _, _ in true }
14321434 Current . git. lastCommitDate = { @Sendable _ in . t1 }
@@ -1517,6 +1519,7 @@ class AnalyzerTests: AppTestCase {
15171519 $0. date. now = . now
15181520 $0. environment. loadSPIManifest = { _ in nil }
15191521 $0. fileManager. fileExists = { @Sendable _ in true }
1522+ $0. git. commitCount = { @Sendable _ in 12 }
15201523 } operation: {
15211524 // setup
15221525 let pkg = try await savePackage ( on: app. db, id: . id0, " https://github.com/foo/1 " . url, processingStage: . ingestion)
@@ -1525,7 +1528,6 @@ class AnalyzerTests: AppTestCase {
15251528 name: " 1 " ,
15261529 owner: " foo " ,
15271530 stars: 100 ) . save ( on: app. db)
1528- Current . git. commitCount = { @Sendable _ in 12 }
15291531 Current . git. getTags = { @Sendable _ in [ ] }
15301532 Current . git. hasBranch = { @Sendable _, _ in true }
15311533 Current . git. firstCommitDate = { @Sendable _ in . t0 }
0 commit comments