29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import { test, expect, describe } from "bun:test";
|
||
import { rdMeegoContacts } from "../src/meego";
|
||
|
||
// 任务 f881ef9a:RD 把 Meego 单流转到 RESOLVED 后,经办人 / 当前负责人都交回给提单 QA,
|
||
// 复核打回再跑的那几轮 commit 记到了 QA 名下。交回之后经办人不再算 RD。
|
||
describe("rdMeegoContacts", () => {
|
||
const c = (state: string | null) => ({ assignee: "qa@x.com", assignees: ["qa@x.com"], reporter: "qa@x.com", state });
|
||
|
||
test("还在修:经办人原样保留", () => {
|
||
for (const s of ["OPEN", "IN PROGRESS", "REOPENED", null]) {
|
||
expect(rdMeegoContacts(c(s)).assignee).toBe("qa@x.com");
|
||
expect(rdMeegoContacts(c(s)).assignees).toEqual(["qa@x.com"]);
|
||
}
|
||
});
|
||
|
||
test("RESOLVED / DONE / CLOSED:清空经办人,reporter 不动", () => {
|
||
for (const s of ["RESOLVED", "resolved", "DONE", "closed"]) {
|
||
const r = rdMeegoContacts(c(s));
|
||
expect(r.assignee).toBeNull();
|
||
expect(r.assignees).toEqual([]);
|
||
expect(r.reporter).toBe("qa@x.com");
|
||
}
|
||
});
|
||
|
||
test("没有 state 字段(查询失败的兜底对象)也能用", () => {
|
||
expect(rdMeegoContacts({ assignee: null, reporter: null })).toEqual({ assignee: null, reporter: null });
|
||
});
|
||
});
|