Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

use-thread-pr.test.ts

36 lines1.1 KB

1import type { VcsStatusResult } from "@t3tools/contracts";
2import { describe, expect, it } from "vite-plus/test";
3​
4import { presentThreadPr } from "./thread-pr-presentation";
5​
6const pullRequest: NonNullable<VcsStatusResult["pr"]> = {
7 number: 3774,
8 title: "Desktop-style pull request indicator",
9 url: "https://github.com/t3tools/t3code/pull/3774",
10 baseRef: "main",
11 headRef: "codex/desktop-style-pr-indicator",
12 state: "merged",
13};
14​
15describe("presentThreadPr", () => {
16 it("uses the compact pull request number label without a hash prefix", () => {
17 expect(presentThreadPr(pullRequest, undefined)).toMatchObject({
18 label: "3774",
19 accessibilityLabel: "#3774 pull request merged",
20 textClassName: "text-violet-600 dark:text-violet-400",
21 });
22 });
23​
24 it("uses merge-request terminology for GitLab", () => {
25 expect(
26 presentThreadPr(pullRequest, {
27 kind: "gitlab",
28 name: "GitLab",
29 baseUrl: "https://gitlab.com",
30 }),
31 ).toMatchObject({
32 label: "3774",
33 accessibilityLabel: "#3774 merge request merged",
34 });
35 });
36});