summaryrefslogtreecommitdiff
path: root/HutchTests/BuildTaskTests.swift
blob: 2e2a1e0d4b7613c1c28b749c7e2540cb82951d94 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)
    }
}