import { describe, expect, test } from "bun:test"; import { boardColumnOf } from "../src/lib/board"; import type { BoardItem } from "../src/types"; /** 批量任务的任务清单用首页看板的列名写状态:同一张卡在两处必须是同一个词。 */ const bug = (x: Partial & { status: string }) => ({ kind: "bug", meegoState: null, mrState: null, mergedIntoBaseAt: null, watchWithdrawn: null, ...x }) as unknown as BoardItem; describe("boardColumnOf:首页看板上的列", () => { test("待人工复核 → 结果审阅;评估中和待确认拆成两列", () => { expect(boardColumnOf(bug({ status: "manual_review" })).label).toBe("col.review"); expect(boardColumnOf(bug({ status: "initializing" })).label).toBe("col.evaluating"); expect(boardColumnOf(bug({ status: "info_required" })).label).toBe("col.confirm"); expect(boardColumnOf(bug({ status: "awaiting_fix" })).label).toBe("col.queued"); expect(boardColumnOf(bug({ status: "fixing" })).label).toBe("col.running"); }); test("复核通过之后按 MR / Meego 分:待 QA、MR 待合入、已完成、QA 打回", () => { expect(boardColumnOf(bug({ status: "fix_succeeded" })).label).toBe("col.qa"); expect(boardColumnOf(bug({ status: "fix_succeeded", meegoState: "CLOSED", mrState: "opened" })).label).toBe("col.awaitingMerge"); expect(boardColumnOf(bug({ status: "fix_succeeded", meegoState: "CLOSED", mrState: "merged" })).label).toBe("col.done"); expect(boardColumnOf(bug({ status: "fix_succeeded", meegoState: "REOPENED" })).label).toBe("col.qaReopened"); }); test("托管期间撤回的算「平台没跑」,负责人归档的算归档", () => { expect(boardColumnOf(bug({ status: "cancelled", watchWithdrawn: "meego_closed" })).label).toBe("col.notRunSplit"); expect(boardColumnOf(bug({ status: "archived", watchWithdrawn: "owner_archived" })).label).toBe("col.archived"); expect(boardColumnOf(bug({ status: "cancelled" })).label).toBe("col.failed"); }); });