From 755accf590bec6e81d1b2484d8501c95798c1cbe Mon Sep 17 00:00:00 2001 From: "t3-code[bot]" <269035359+t3-code[bot]@users.noreply.github.com> Date: Thu, 15 Oct 2026 08:32:42 +0530 Subject: [PATCH] test(web): remove duplicate change request parser tests (#13591) Co-authored-by: t3-code[bot] <269035359+t3-code[bot]@users.noreply.github.com> --- apps/web/src/lib/openPullRequestLink.test.ts | 102 ------------------- 1 file changed, 102 deletions(-) diff --git a/apps/web/src/lib/openPullRequestLink.test.ts b/apps/web/src/lib/openPullRequestLink.test.ts index 0aaa43a735a72551e3c3c247d8cafe84a27b230d..7eaef910ade77b23bb84f0c04f8d1f94a2765b47 100644 --- a/apps/web/src/lib/openPullRequestLink.test.ts +++ b/apps/web/src/lib/openPullRequestLink.test.ts @@ -226,108 +226,6 @@ describe("shouldOpenPullRequestExternally", () => { }); }); -describe("parseChangeRequestUrl", () => { - it("reads a GitHub pull request", () => { - expect(parseChangeRequestUrl("https://github.com/T3Tools/T3Code/pull/123")).toEqual({ - host: "github.com", - repository: "t3tools/t3code", - number: 123, - }); - }); - - it("reads a pull request on a GitHub Enterprise host", () => { - expect(parseChangeRequestUrl("https://github.acme.test/platform/api/pull/7")).toEqual({ - host: "github.acme.test", - repository: "platform/api", - number: 7, - }); - }); - - it("reads a GitLab merge request, nested groups and all", () => { - expect( - parseChangeRequestUrl("https://gitlab.com/t3tools/platform/t3code/-/merge_requests/42"), - ).toEqual({ - host: "gitlab.com", - repository: "t3tools/platform/t3code", - number: 42, - }); - }); - - it("reads a merge request on a self-hosted GitLab named nothing like GitLab", () => { - expect(parseChangeRequestUrl("https://code.acme.test/team/project/-/merge_requests/9")).toEqual( - { - host: "code.acme.test", - repository: "team/project", - number: 9, - }, - ); - }); - - it("reads a Bitbucket pull request", () => { - expect(parseChangeRequestUrl("https://bitbucket.org/workspace/repo/pull-requests/5")).toEqual({ - host: "bitbucket.org", - repository: "workspace/repo", - number: 5, - }); - }); - - it("reads both Azure DevOps URL forms, keeping `_git` in the repository path", () => { - expect( - parseChangeRequestUrl("https://dev.azure.com/acme/platform/_git/t3code/pullrequest/17"), - ).toEqual({ - host: "dev.azure.com", - repository: "acme/platform/_git/t3code", - number: 17, - }); - expect( - parseChangeRequestUrl("https://acme.visualstudio.com/platform/_git/t3code/pullrequest/17"), - ).toEqual({ - host: "acme.visualstudio.com", - repository: "platform/_git/t3code", - number: 17, - }); - }); - - it("survives trailing segments, a trailing slash and a query string", () => { - expect(parseChangeRequestUrl("https://github.com/t3tools/t3code/pull/123/files?w=1")).toEqual({ - host: "github.com", - repository: "t3tools/t3code", - number: 123, - }); - expect( - parseChangeRequestUrl("https://gitlab.com/team/project/-/merge_requests/42/diffs#note_1"), - ).toEqual({ host: "gitlab.com", repository: "team/project", number: 42 }); - expect( - parseChangeRequestUrl("https://bitbucket.org/team/repo/pull-requests/5/commits"), - ).toEqual({ host: "bitbucket.org", repository: "team/repo", number: 5 }); - expect(parseChangeRequestUrl("https://github.com/t3tools/t3code/pull/123/")).toEqual({ - host: "github.com", - repository: "t3tools/t3code", - number: 123, - }); - }); - - it("claims nothing it cannot be sure of, so the link goes to the browser", () => { - for (const link of [ - "https://github.com/t3tools/t3code/issues/123", - "https://github.com/t3tools/t3code/commit/0a1b2c3", - "https://github.com/t3tools/t3code", - "https://github.com/t3tools/t3code/pull/abc", - "https://gitlab.com/t3tools/t3code/-/snippets/12", - "https://gitlab.com/t3tools/t3code/-/issues/12", - // A path shape that means nothing off its own host. - "https://blog.example.test/2026/updates/pull/3", - // A lookalike is deliberately not fought here: `github.com.evil.test` reads as a GitHub - // Enterprise install and there is no way to tell it from one. It is `findProjectForChange - // Request` that refuses it, because no project in the workspace is checked out from it. - "javascript:alert(1)//github.com/t3tools/t3code/pull/1", - "not a url", - ]) { - expect(parseChangeRequestUrl(link), link).toBeNull(); - } - }); -}); - describe("findProjectOnChangeRequestHost", () => { const project = (id: string, identity: Record) => ({ id, repositoryIdentity: identity }) as never; -- 2.54.0