Initial import of streamline

This commit is contained in:
2026-11-16 17:26:44 -08:00
commit 8e4aec1855
1221 changed files with 274256 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
import { test, expect, describe } from "bun:test";
import { qaPolicyNoteText } from "../src/components/QaPolicyNote";
import { DEFAULT_REVIEW_POLICY, QA_FIRST_ACTOR, isQaReopenNote, QA_REOPEN_NOTE_HEAD, type TaskReviewInfo } from "@bbbug/shared/review_policy";
import type { Task } from "../src/types";
const qa = (over: Partial<TaskReviewInfo> = {}): TaskReviewInfo => ({ policy: { id: "qa_first", maxChangedUnits: 5 }, approvedBy: null, unreproToQa: false, route: null, ...over });
const task = (over: Partial<Task>) => ({ status: "manual_review", meegoState: "OPEN", ...over } as Task);
describe("drawer note under the QA-first policy", () => {
test("default policy never shows anything", () => {
const info: TaskReviewInfo = { policy: DEFAULT_REVIEW_POLICY, approvedBy: null, unreproToQa: false, route: null };
for (const t of [task({}), task({ status: "fix_succeeded", meegoState: "REOPENED" }), task({ status: "unreproducible", meegoState: "RESOLVED" })]) {
expect(qaPolicyNoteText(t, info, true)).toBeNull();
}
expect(qaPolicyNoteText(task({}), null, true)).toBeNull();
});
test("review that missed routing says why RD still has it", () => {
const s = qaPolicyNoteText(task({}), qa({ route: { toQa: false, reason: "too_large", units: 8 } }), true)!;
expect(s).toContain("改动 8 处,上限 5");
});
test("a platform hand-off says no RD review; an RD approval says nothing", () => {
expect(qaPolicyNoteText(task({ status: "fix_succeeded", meegoState: "RESOLVED" }), qa({ approvedBy: QA_FIRST_ACTOR }), true)).toContain("未经 RD 复核");
expect(qaPolicyNoteText(task({ status: "fix_succeeded", meegoState: "RESOLVED" }), qa({ approvedBy: "rd.li@bytedance.com" }), true)).toBeNull();
expect(qaPolicyNoteText(task({ status: "fix_succeeded", meegoState: "CLOSED" }), qa({ approvedBy: QA_FIRST_ACTOR }), true)).toBeNull();
});
test("QA reopen waits for the reason; an unrepro reopen only counts after a hand-off", () => {
expect(qaPolicyNoteText(task({ status: "fix_succeeded", meegoState: "REOPENED" }), qa(), true)).toContain("自动按它重修");
expect(qaPolicyNoteText(task({ status: "unreproducible", meegoState: "REOPENED" }), qa({ unreproToQa: true }), true)).toContain("自动按它重修");
expect(qaPolicyNoteText(task({ status: "unreproducible", meegoState: "REOPENED" }), qa(), true)).toBeNull();
expect(qaPolicyNoteText(task({ status: "unreproducible", meegoState: "RESOLVED" }), qa({ unreproToQa: true }), true)).toContain("交 QA 判断");
});
test("QA notes are recognised by their header", () => {
expect(isQaReopenNote(`${QA_REOPEN_NOTE_HEAD}\n还是能复现`)).toBe(true);
expect(isQaReopenNote("颜色是不是还是不对?")).toBe(false);
});
});