Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2
3import { resolveThreadReferenceCopyTarget } from "./threadReference.ts";
4
5describe("resolveThreadReferenceCopyTarget", () => {
6 it("prefers a durable linked pull request", () => {
7 expect(
8 resolveThreadReferenceCopyTarget({
9 threadId: "thread-1",
10 linkedPullRequestUrl: "https://github.com/t3/pr/12",
11 detectedPullRequestUrl: "https://github.com/t3/pr/13",
12 }),
13 ).toMatchObject({
14 kind: "pull-request",
15 value: "https://github.com/t3/pr/12",
16 successTitle: "PR link copied",
17 });
18 });
19
20 it("uses a pull request detected from the active branch", () => {
21 expect(
22 resolveThreadReferenceCopyTarget({
23 threadId: "thread-1",
24 detectedPullRequestUrl: "https://github.com/t3/pr/13",
25 }),
26 ).toMatchObject({
27 kind: "pull-request",
28 value: "https://github.com/t3/pr/13",
29 });
30 });
31
32 it("falls back to the thread ID", () => {
33 expect(resolveThreadReferenceCopyTarget({ threadId: "thread-1" })).toEqual({
34 kind: "thread",
35 value: "thread-1",
36 clipboardTarget: "thread ID",
37 successTitle: "Thread ID copied",
38 failureTitle: "Failed to copy thread ID",
39 });
40 });
41});