From 0d61e05e98f6f020722ee4d43f024c1da348d2a9 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Thu, 14 May 2026 12:41:55 -0500 Subject: feat: add Safari extension for sourcehut deep links --- HutchTests/DeepLinkTests.swift | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'HutchTests/DeepLinkTests.swift') diff --git a/HutchTests/DeepLinkTests.swift b/HutchTests/DeepLinkTests.swift index c57cfce..500c4cd 100644 --- a/HutchTests/DeepLinkTests.swift +++ b/HutchTests/DeepLinkTests.swift @@ -19,7 +19,19 @@ struct DeepLinkTests { @Test func parsesRepositoryLink() { let link = DeepLink(url: HutchDeepLinkURL.repositoryGit) - #expect(link == .repository(owner: "~user", repo: "repo")) + #expect(link == .repository(service: .git, owner: "~user", repo: "repo")) + } + + @Test + func parsesHgRepositoryLink() { + let link = DeepLink(url: HutchDeepLinkURL.repositoryHg) + #expect(link == .repository(service: .hg, owner: "~user", repo: "repo")) + } + + @Test + func parsesServiceOwnerRootAsUserProfile() { + let link = DeepLink(url: HutchDeepLinkURL.gitOwnerRoot) + #expect(link == .userProfile(owner: "~owner")) } @Test @@ -34,6 +46,18 @@ struct DeepLinkTests { #expect(link == .build(jobId: 12345)) } + @Test + func parsesBuildJobLinkWithOwnerPath() { + let link = DeepLink(url: HutchDeepLinkURL.buildJobWithOwner) + #expect(link == .build(jobId: 12345)) + } + + @Test + func parsesMailingListLink() { + let link = DeepLink(url: HutchDeepLinkURL.mailingList) + #expect(link == .mailingList(owner: "~owner", list: "list")) + } + @Test func parsesBuildsTabLink() { let link = DeepLink(url: HutchDeepLinkURL.builds) @@ -64,6 +88,12 @@ struct DeepLinkTests { #expect(link == .lookup) } + @Test + func parsesUserProfileLink() { + let link = DeepLink(url: HutchDeepLinkURL.userProfile) + #expect(link == .userProfile(owner: "~owner")) + } + @Test func rejectsNonHutchScheme() { let link = DeepLink(url: URL(string: "https://example.com/home")!) -- cgit v1.2.3