From 0e461a382257979037e8927e5f6b468635b0a7fe Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Mon, 13 Apr 2026 09:57:23 -0500 Subject: 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 --- HutchTests/SRHTWebURLTests.swift | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'HutchTests') 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) == "git@git.sr.ht:~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") + } } -- cgit v1.2.3