summaryrefslogtreecommitdiff
path: root/HutchTests
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-13 09:57:23 -0500
committerChristian Cleberg <[email protected]>2026-04-13 09:57:23 -0500
commit0e461a382257979037e8927e5f6b468635b0a7fe (patch)
tree0aa3a19f6f8f966b0e90f4874ed54359a7898107 /HutchTests
parentee9f2904aa319231b7047fca3cb069f0c07019cd (diff)
downloadhutch-0e461a382257979037e8927e5f6b468635b0a7fe.tar.gz
hutch-0e461a382257979037e8927e5f6b468635b0a7fe.tar.bz2
hutch-0e461a382257979037e8927e5f6b468635b0a7fe.zip
feat: add power user actions
Implements: https://todo.sr.ht/~ccleberg/hutch/52 Implements: https://todo.sr.ht/~ccleberg/hutch/53 Implements: https://todo.sr.ht/~ccleberg/hutch/54
Diffstat (limited to 'HutchTests')
-rw-r--r--HutchTests/SRHTWebURLTests.swift34
1 files changed, 34 insertions, 0 deletions
diff --git a/HutchTests/SRHTWebURLTests.swift b/HutchTests/SRHTWebURLTests.swift
index 15f242d..a183f00 100644
--- a/HutchTests/SRHTWebURLTests.swift
+++ b/HutchTests/SRHTWebURLTests.swift
@@ -3,10 +3,44 @@ import Testing
@testable import Hutch
struct SRHTWebURLTests {
+ private let repository = RepositorySummary(
+ id: 1,
+ rid: "repo-1",
+ service: .git,
+ name: "hutch",
+ description: nil,
+ visibility: .public,
+ updated: .distantPast,
+ owner: Entity(canonicalName: "~ccleberg"),
+ head: nil
+ )
+ private let tracker = TrackerSummary(
+ id: 2,
+ rid: "tracker-1",
+ name: "todo",
+ description: nil,
+ visibility: .public,
+ updated: .distantPast,
+ owner: Entity(canonicalName: "~ccleberg")
+ )
@Test
func browserOnlyServiceURLsUseCanonicalHosts() {
#expect(SRHTWebURL.chat.absoluteString == "https://chat.sr.ht")
#expect(SRHTWebURL.status.absoluteString == "https://status.sr.ht")
}
+
+ @Test
+ func repositoryAndCloneURLsUseStableUserScopedPaths() {
+ #expect(SRHTWebURL.repository(repository)?.absoluteString == "https://git.sr.ht/~ccleberg/hutch")
+ #expect(SRHTWebURL.httpsCloneURL(repository) == "https://git.sr.ht/~ccleberg/hutch")
+ #expect(SRHTWebURL.sshCloneURL(repository) == "[email protected]:~ccleberg/hutch")
+ }
+
+ @Test
+ func trackerTicketAndBuildURLsUseStableUserScopedPaths() {
+ #expect(SRHTWebURL.tracker(tracker)?.absoluteString == "https://todo.sr.ht/~ccleberg/todo")
+ #expect(SRHTWebURL.ticket(ownerUsername: "ccleberg", trackerName: "todo", ticketId: 42)?.absoluteString == "https://todo.sr.ht/~ccleberg/todo/42")
+ #expect(SRHTWebURL.build(jobId: 12, ownerCanonicalName: "~ccleberg")?.absoluteString == "https://builds.sr.ht/~ccleberg/job/12")
+ }
}