summaryrefslogtreecommitdiff
path: root/HutchTests/BuildTaskTests.swift
diff options
context:
space:
mode:
Diffstat (limited to 'HutchTests/BuildTaskTests.swift')
-rw-r--r--HutchTests/BuildTaskTests.swift27
1 files changed, 27 insertions, 0 deletions
diff --git a/HutchTests/BuildTaskTests.swift b/HutchTests/BuildTaskTests.swift
new file mode 100644
index 0000000..2e2a1e0
--- /dev/null
+++ b/HutchTests/BuildTaskTests.swift
@@ -0,0 +1,27 @@
+import Foundation
+import Testing
+@testable import Hutch
+
+struct BuildTaskTests {
+
+ @Test
+ @MainActor
+ func duplicateTaskNamesProduceDistinctIDsAndLogCacheKeys() {
+ let firstTask = BuildTask(
+ name: "test",
+ status: .failed,
+ log: BuildLog(fullURL: "https://builds.sr.ht/job/1/task/1")
+ ).withOrdinal(0)
+
+ let secondTask = BuildTask(
+ name: "test",
+ status: .failed,
+ log: BuildLog(fullURL: "https://builds.sr.ht/job/1/task/2")
+ ).withOrdinal(1)
+
+ #expect(firstTask.id == "0:test")
+ #expect(secondTask.id == "1:test")
+ #expect(firstTask.id != secondTask.id)
+ #expect(firstTask.logCacheKey != secondTask.logCacheKey)
+ }
+}