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

issueSavedViews.test.ts

29 lines1002 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { EnvironmentId, ProjectId } from "@t3tools/contracts";
4​
5import { issueViewMatches } from "./issueSavedViews";
6​
7const preferences = {
8 who: "assigned",
9 status: "open",
10 issueServer: EnvironmentId.make("env-1"),
11 issueProject: ProjectId.make("project-1"),
12 host: "github.com",
13 q: "crash",
14 label: ["bug", "priority"],
15 assignee: "octocat",
16 order: "created",
17} as const;
18const view = { id: "mine", name: "Issues Assigned to Me", preferences };
19​
20describe("saved issue views", () => {
21 it("matches regardless of label order", () => {
22 expect(issueViewMatches(view, { ...preferences, label: ["priority", "bug"], q: "crash" })).toBe(
23 true,
24 );
25 expect(issueViewMatches(view, { ...preferences, assignee: undefined })).toBe(false);
26 expect(issueViewMatches(view, { ...preferences, label: ["bug"] })).toBe(false);
27 expect(issueViewMatches(view, { ...preferences, issueProject: undefined })).toBe(false);
28 });
29});