Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2
3import { canLinkChangeRequest } from "./usePullRequestLinking";
4import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
5
6describe("canLinkChangeRequest (#9435 / #9440)", () => {
7 const nonGitProject = { id: "scratch-project" } as never;
8 const link = sourceControlClients.parseChangeRequestUrl(
9 "https://github.com/pingdotgg/t3code/pull/15111",
10 )!.link;
11
12 it("links a pasted pull request URL when the server tracks links on the thread, even with no matching project", () => {
13 expect(canLinkChangeRequest("multiple", [nonGitProject], link)).toBe(true);
14 expect(canLinkChangeRequest("multiple", [], link)).toBe(true);
15 });
16
17 it("still requires a matching project in single-link mode, where the link needs a projectId", () => {
18 expect(canLinkChangeRequest("single", [nonGitProject], link)).toBe(false);
19 expect(canLinkChangeRequest("single", [], link)).toBe(false);
20 });
21});