kaneo (minimalist kanban) fork to experiment adding a tangled integration
github.com/usekaneo/kaneo
1import { describe, expect, it } from "vitest";
2import {
3 formatIssueBody,
4 formatIssueTitle,
5 formatSyncComment,
6 formatTaskDescriptionFromIssue,
7 getLabelsForIssue,
8} from "../../../../../apps/api/src/plugins/github/utils/format";
9
10describe("github format helpers", () => {
11 it("returns the title unchanged", () => {
12 expect(formatIssueTitle("Ship notifications")).toBe("Ship notifications");
13 });
14
15 it("formats issue bodies with and without a description", () => {
16 expect(formatIssueBody(null, "task_123")).toBe("<sub>Task: task_123</sub>");
17 expect(formatIssueBody("Body text", "task_123")).toBe(`Body text
18
19---
20<sub>Task: task_123</sub>`);
21 });
22
23 it("formats sync comments and task descriptions", () => {
24 expect(formatSyncComment("task_123")).toBe("Task: task_123");
25 expect(formatTaskDescriptionFromIssue("Issue body")).toBe("Issue body");
26 expect(formatTaskDescriptionFromIssue(null)).toBe("");
27 });
28
29 it("builds labels while skipping no-priority", () => {
30 expect(getLabelsForIssue("high", "in-review")).toEqual([
31 "priority:high",
32 "status:in-review",
33 ]);
34 expect(getLabelsForIssue("no-priority", "done")).toEqual(["status:done"]);
35 expect(getLabelsForIssue(null, "planned")).toEqual(["status:planned"]);
36 });
37});