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

issueParams.test.ts

19 lines905 Bytes

1import { expect, it } from "vite-plus/test";
2​
3import { isSelectedIssueRow, selectedIssueKeyOf } from "./issueParams";
4​
5const row = { environmentId: "e", projectId: "p", host: "github.com", scope: "o/r", key: "7" };
6const link = { environmentId: "e", projectId: "p", scope: "o/r", issueKey: "7" };
7​
8it("selects the listed row a hostless issue link names", () => {
9 const hostless = selectedIssueKeyOf(link);
10 expect(isSelectedIssueRow(hostless, row)).toBe(true);
11 expect(isSelectedIssueRow(hostless, { ...row, host: "ghe.example.com" })).toBe(true);
12 expect(isSelectedIssueRow(hostless, { ...row, projectId: "other" })).toBe(false);
13});
14​
15it("keeps an explicit host exact", () => {
16 const selected = selectedIssueKeyOf({ ...link, host: "GitHub.com" });
17 expect(isSelectedIssueRow(selected, row)).toBe(true);
18 expect(isSelectedIssueRow(selected, { ...row, host: "ghe.example.com" })).toBe(false);
19});