Files
streamline/satellite/test/verify_prompt.test.ts
T
2026-11-16 17:26:44 -08:00

436 lines
22 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, test } from "bun:test";
import { parseAuditReport, parseUiTree } from "@bbbug/shared/audit_report";
import type { Verification } from "@bbbug/shared/types";
import {
parseVerifySpec, UI_AUDIT_REPORT_FILE, UI_AUDIT_REPORT_SKELETON,
VERIFY_STATUS_DONE, VERIFY_STATUS_FAILED,
} from "@bbbug/shared/verify_prompt";
import {
buildVerificationFirstPrompt, buildVerificationSecondPrompt, lastMainContextTokens, parseVerifyStatus, pendingScenes, relayPreface,
verificationSpec, verifyBudgetMs, VERIFY_TIMEOUT_MS,
} from "../src/verify_runner";
import { pickCatInstance } from "../src/cat_instances";
import { mergeAuditKnowledge, renderAuditKnowledge } from "@bbbug/shared/audit_report";
import { checksFromPresets, UI_AUDIT_CHECK_PRESETS, UI_AUDIT_SCOPE_PRESETS, validateCustomCheck } from "@bbbug/shared/verify_scope_templates";
/**
* 验证线两份独立执行模板(verify.run.first / verify.run.second)渲染后的内容。
*
* 最要紧的是**反向**断言:模板里不能再出现 Feature 那套交付代码的规矩(TestSpec、
* ImplReport、推分支、STATUS: IMPLEMENTED)。验证线曾经是「Feature 模板 + 末尾追加一段
* 前面的规矩这轮不适用」,拆出来之后如果有人又从 Feature 模板复制粘贴,第一个发现的
* 应该是这里。
*/
const WS = "/tmp/bug_workspace/verify-abc";
function verification(over: Partial<Verification> = {}): Verification {
return {
id: "abcdef12-0000-0000-0000-000000000000",
title: "社交场景 UI 走查",
description: "私信与 Inbox 全链路",
platform: "ios",
baseRef: null,
remark: null,
attachments: null,
verifySpec: JSON.stringify({ format: "ui-audit", scope: "社交场景全链路", langs: ["en", "de", "ar"], personas: ["新用户"] }),
reviewFeedback: null,
reviewHistory: null,
workspacePath: WS,
pinned: 0,
status: "awaiting_verify",
priorityKey: 0,
watchers: [],
createdAt: 0,
startedAt: null,
finishedAt: null,
durationMs: null,
totalDurationMs: null,
logPath: null,
failureReason: null,
attempts: 0,
executorNodeId: null,
baseline: null,
...over,
};
}
describe("parseVerifySpec", () => {
test("认出规约", () => {
const s = parseVerifySpec(JSON.stringify({ format: "ui-audit", scope: "DM 全链路", langs: ["en", "de"] }))!;
expect(s.scope).toBe("DM 全链路");
expect(s.langs).toEqual(["en", "de"]);
});
test("坏数据当没有 —— 调用方会退回用任务描述当 scope", () => {
expect(parseVerifySpec(null)).toBeNull();
expect(parseVerifySpec("不是 json")).toBeNull();
expect(parseVerifySpec(JSON.stringify({ format: "ui-audit" }))).toBeNull(); // 没有 scope
});
test("没有规约的老任务:标题 + 描述当 scope", () => {
const s = verificationSpec(verification({ verifySpec: null }));
expect(s.scope).toContain("社交场景 UI 走查");
expect(s.scope).toContain("私信与 Inbox 全链路");
});
});
describe("verify.run.first", () => {
const prompt = buildVerificationFirstPrompt(verification(), WS);
test("开门见山:不交付代码,交付证据和报告", () => {
expect(prompt).toContain("不改代码、不构建、不装包、不建分支、不 commit、不 push、不开 MR");
expect(prompt).toContain(`evidence/${UI_AUDIT_REPORT_FILE}`);
});
test("收尾哨兵是验证线自己的,不再借 Feature 的 IMPLEMENTED", () => {
expect(prompt).toContain(`STATUS: ${VERIFY_STATUS_DONE}`);
expect(prompt).toContain(`STATUS: ${VERIFY_STATUS_FAILED}`);
expect(prompt).not.toContain("STATUS: IMPLEMENTED");
});
test("没有 Feature 那套规矩的残留", () => {
for (const s of ["TestSpec", "EffectiveSpec", "ImplReport", "git push", "git checkout -b"]) {
expect(prompt).not.toContain(s);
}
});
test("规约里的语言矩阵和用户形态原样进 prompt", () => {
expect(prompt).toContain("社交场景全链路");
expect(prompt).toContain("en · de · ar");
expect(prompt).toContain("新用户");
});
test("不勾专项就只按范围查,没有缺省检查项", () => {
expect(prompt).toContain("查什么只看上面的「走查范围」");
expect(prompt).not.toContain("44×44pt");
expect(prompt).not.toContain("--cat 热区");
expect(prompt).not.toContain("逐条对照");
});
test("证据采集的硬要求都在", () => {
expect(prompt).toContain("2 倍"); // 采样率
expect(prompt).toContain(".ui.txt"); // 结构树配套
expect(prompt).toContain(".navfail.png"); // 到不了也是结论
expect(prompt).toContain("绝不复用上一帧"); // 字节重复
});
test("可达性要写清原因分类和解封条件", () => {
expect(prompt).toContain("原因分类");
expect(prompt).toContain("还差什么才能解封");
});
test("占位符全部渲染掉了", () => {
expect(prompt).not.toMatch(/\{\{\w+\}\}/);
expect(prompt).toContain(`${WS}/evidence/${UI_AUDIT_REPORT_FILE}`);
expect(prompt).toContain("flow-r1-"); // batchNo = attempts + 1
});
test("没有语言矩阵时不硬编一个出来", () => {
const p = buildVerificationFirstPrompt(verification({ verifySpec: JSON.stringify({ format: "ui-audit", scope: "x" }) }), WS);
expect(p).toContain("界面当前语言");
expect(p).not.toContain("语言矩阵**(");
});
test("控制面下发的模板优先于内置默认", () => {
expect(buildVerificationFirstPrompt(verification(), WS, "自定义 {{title}}")).toContain("自定义 社交场景 UI 走查");
});
});
describe("范围模板 / 关注问题 / 状态构造 / 预算", () => {
const spec = {
format: "ui-audit", scope: UI_AUDIT_SCOPE_PRESETS[0].scope, scopeTemplate: UI_AUDIT_SCOPE_PRESETS[0].id,
checks: checksFromPresets(["hit-area-spec", "long-lang-truncation", "不存在的"]), budgetHours: 8,
};
const android = buildVerificationFirstPrompt(verification({ platform: "android", verifySpec: JSON.stringify(spec) }), WS);
test("勾了的专项逐条注入,类别要照填", () => {
expect(spec.checks).toHaveLength(2);
expect(android).toContain("【热区】按对应平台和组件规范");
expect(android).toContain("逐条对照");
expect(android).toContain("照填【】里的名字");
expect(android).not.toContain("建单人没有勾专项");
});
test("状态构造阶梯和平台的 Frida 接入都渲染进去了", () => {
expect(android).toContain("进不去的状态,可以造出来");
expect(android).toContain("frida -U -n TikTok-M");
expect(android).toContain("## 5. 状态构造记录");
const ios = buildVerificationFirstPrompt(verification({ verifySpec: JSON.stringify(spec) }), WS);
// iOS 先普通用户 attach、再 root;「sudo -n true 要密码」不能当成这一档不可用(766f1074 第 2 轮普通用户就挂上了)。
expect(ios).toContain("以普通用户");
expect(ios).toContain('sudo -n "$(which frida)"');
expect(ios).not.toContain("非 root 必定超时");
// 自救表:历史上 agent 自己解决过的 Frida 报错,都不是 BLOCKED 的理由。
for (const sym of ["remote frida-server: closed", "timeout was reached", "unable to intercept function", "Java.deoptimizeEverything()"]) {
expect(android).toContain(sym);
}
expect(ios).not.toMatch(/\{\{\w+\}\}/);
});
test("预算写进 prompt,并要求开工先把场景清单写成「待走」", () => {
expect(android).toContain("本轮预算 **8 小时**");
expect(android).toContain("状态填「待走」");
});
test("预算:缺省 = 单会话上限,封顶 12 小时,只对 UI 走查生效", () => {
expect(verifyBudgetMs({ format: "ui-audit" })).toBe(VERIFY_TIMEOUT_MS);
expect(verifyBudgetMs({ format: "ui-audit", budgetHours: 8 })).toBe(8 * 3600_000);
expect(verifyBudgetMs({ format: "ui-audit", budgetHours: 100 })).toBe(12 * 3600_000);
expect(verifyBudgetMs({ format: "case-run", budgetHours: 8 })).toBe(VERIFY_TIMEOUT_MS);
});
test("接力:只数第 3 节的「待走」", () => {
const md = UI_AUDIT_REPORT_SKELETON
.replace("| 页面 | <lang1> | <lang2> | … |", "| 页面 | en |")
.replace("|---|---|---|---|\n| `s1-<面>/01-<页面>` | ✅ | ⚠ | … |", "|---|---|\n| `s1-dm/01-inbox` | ✅ |")
.replace(/\| <场景> \|[^\n]*\|/, "| A | 待走 | 还没走 |\n| B | 待走 | 还没走 |\n| C | BLOCKED(缺账号) | 试过换号 |");
expect(pendingScenes(md)).toBe(2);
expect(pendingScenes("")).toBe(0);
expect(relayPreface({ session: 2, usedMin: 90, leftMin: 300, pending: 2, reportPath: "evidence/UI-Audit-Report.md" }))
.toContain("「待走」的 2 个场景");
});
test("预设 id 都唯一", () => {
expect(new Set(UI_AUDIT_CHECK_PRESETS.map((p) => p.id)).size).toBe(UI_AUDIT_CHECK_PRESETS.length);
});
});
describe("verify.run.second", () => {
const prompt = buildVerificationSecondPrompt(verification({
attempts: 1,
reviewHistory: [{ at: 1, source: "human", round: 1, text: "Story 场景其实能进,补采" }],
}), WS);
test("在上一轮报告上更新,并带上复核意见", () => {
expect(prompt).toContain("第 2 轮走查");
expect(prompt).toContain("不要重写");
expect(prompt).toContain("Story 场景其实能进,补采");
expect(prompt).toContain("## 第 2 轮复核处理");
});
test("同样没有 Feature 的收尾哨兵", () => {
expect(prompt).toContain(`STATUS: ${VERIFY_STATUS_DONE}`);
expect(prompt).not.toContain("STATUS: IMPLEMENTED");
expect(prompt).not.toMatch(/\{\{\w+\}\}/);
});
});
describe("parseVerifyStatus", () => {
test("最后一个说了算", () => {
expect(parseVerifyStatus(`STATUS: ${VERIFY_STATUS_FAILED}\n…\nSTATUS: ${VERIFY_STATUS_DONE}`)).toBe(VERIFY_STATUS_DONE);
});
test("没有哨兵 → null;Feature 的哨兵不算", () => {
expect(parseVerifyStatus("STATUS: IMPLEMENTED")).toBeNull();
expect(parseVerifyStatus("")).toBeNull();
});
});
/**
* 这一条是两端的契约:prompt 里那份报告骨架,必须能被 `parseAuditReport` 吃下去。
*
* 漂了不会有人报错 —— 报告解析不出来时面板会静默退回普通报告,证据还在但交互式
* 视图消失。所以把骨架填上值直接喂给解析器。
*/
describe("报告骨架 ↔ 解析器", () => {
const filled = UI_AUDIT_REPORT_SKELETON
.replace("<标题:被测对象 + 范围 + 语言数>", "TikTok iOS 社交场景走查(2 种语言)")
.replace("<包名与版本,以及它对应的源码 commit>", "TikTokM v47.0.0 (83099bba)")
.replace("<索引代码时用的 commit>", "81edc8c7")
.replace("<设备 / 模拟器 + 分辨率>", "macCatalyst 393×852 @3x")
.replace("<账号及其状态;有没有登录 / 新建 / 改动>", "@pinegrove73,全程未登录未登出")
.replace("| 截图 | <张数> |", "| 截图 | 12 |")
.replace("| 页面 | <页面数> × <语言数> |", "| 页面 | 2 × 2 |")
.replace("| P1 | <n> | <n> |", "| P1 | 1 | 2 |")
.replace("| <类别> | <n> | <n> |", "| 文案截断 / 折行 | 1 | 2 |")
.replace("| 页面 | <lang1> | <lang2> | … |", "| 页面 | en | de |")
.replace("|---|---|---|---|\n| `s1-<面>/01-<页面>` | ✅ | ⚠ | … |",
"|---|---|---|\n| `s1-dm/01-inbox` | ⚠ | ⚠ |\n| `s1-dm/02-chat` | ✅ | ✅ |")
.replace("| <场景> | 待走 / BLOCKED(环境) / BLOCKED(缺账号) / BLOCKED(缺数据) / 不采集(主动) / 部分覆盖 | <试到哪一步、观察到什么、还差什么;「待走」写一句要走什么> |",
"| Story 拍摄 | BLOCKED(环境) | macCatalyst 进不去相机 |\n| Streak Pet 空态 | 待走 | 还没开始 |")
.replace("### 面 1 · <这一面叫什么>", "### 面 1 · 私信")
.replace("#### `s1-<面>/01-<页面>` · <这一页的中文名,例:收藏列表页 · 空状态>", "#### `s1-dm/01-inbox` · 私信收件箱")
.replace("| 1 | P1 | <类别> | <语言> | <一句话:在哪、做了什么、看到什么、因此做不了什么。界面原文抄进「」> | <进入路径 + 账号 / 数据前提 + 语言 / 设置 + 是否构造态;写到别人拿真机照着能看到> | <为什么会这样 + 依据;拿不准写「推测」和还差什么,查不出写「未查明」> | <取证:请求与回执 / log_id / 实测尺寸 / 符号命中;没有就写 —> | <文件:行,没有就写 —> |",
"| 1 | P1 | 文案与多语言 | en de | 收件箱顶部的筛选项被截断成「Unread」,看不出这一栏是什么。 | 私信 → 收件箱,语言切 de。 | 四个 chip 等宽压缩。 | 实测 chip 宽 64pt,log_id 202609…。 | Modules/IM/Chip.m:12 |")
.replace(/\| `s2-favorites\/04-list-empty` \| <[^\n]*\|/, "| `s1-dm/02-chat` | Frida 让消息列表返回空 | `hooks/s1-dm-02-chat.js` |");
const r = parseAuditReport(filled);
test("骨架填上值之后解析得出来", () => {
expect(r).toBeTruthy();
});
test("四段都被认出来", () => {
expect(r!.langs).toEqual(["en", "de"]);
expect(r!.pages.map((p) => p.id)).toEqual(["s1-dm/01-inbox", "s1-dm/02-chat"]);
expect(r!.blocked).toHaveLength(2);
expect(r!.blocked.map((b) => b.cause)).toEqual(["env", "pending"]);
expect(r!.totals.issues).toBe(1);
expect(r!.totals.instances).toBe(2);
});
test("四级标题里的中文页面名被认出来,老写法没有名字也照样解析", () => {
expect(r!.pages[0].title).toBe("私信收件箱");
expect(r!.pages[1].title).toBeUndefined();
});
test("第 5 节状态构造记录被认出来,且不混进逐页问题", () => {
expect(r!.constructed).toEqual([{ page: "s1-dm/02-chat", how: "Frida 让消息列表返回空", script: "hooks/s1-dm-02-chat.js" }]);
expect(r!.pages.find((p) => p.id === "s1-dm/02-chat")!.issues).toHaveLength(0);
});
test("覆盖矩阵的三态符号没漂", () => {
expect(r!.pages[0].coverage).toEqual(["issue", "issue"]);
expect(r!.pages[1].coverage).toEqual(["ok", "ok"]);
});
test("现象、复现条件、原因、细节分栏,代码位置落在最后一列", () => {
const iss = r!.pages[0].issues[0];
// 复现条件和原因在面板上直接展示,也随转单写进修复单。
expect(iss.repro).toBe("私信 → 收件箱,语言切 de。");
expect(iss.cause).toBe("四个 chip 等宽压缩。");
// 现象一句话给非技术读者;取证流水在细节里,面板默认折叠。
expect(iss.text).toContain("「Unread」");
expect(iss.text).not.toContain("log_id");
expect(iss.detail).toContain("log_id");
expect(r!.pages[0].issues[0].code).toContain("Chip.m:12");
});
});
describe("长走查的六项优化(都只作用于 UI 走查)", () => {
const spec = { format: "ui-audit", scope: "社交主场景", langs: ["en", "de"], accounts: "空账号:138xxxx / 验证码 000000" };
const ios = buildVerificationFirstPrompt(verification({ verifySpec: JSON.stringify(spec) }), WS, null,
{ knowledge: "#### 之前的走查记下的\n| `s1-profile/14-story-archive` | Story 归档 | 我 → 精选 New |" });
const android = buildVerificationFirstPrompt(verification({ platform: "android", verifySpec: JSON.stringify(spec) }), WS);
test("1 看图节制 + 交棒信号", () => {
expect(ios).toContain("sips -Z 480");
expect(ios).toContain("派一个子 Agent 看图");
expect(ios).toContain(`${WS}/logs/HANDOFF`);
});
test("2 dispose 代替冷启 + 照已知路由走", () => {
expect(ios).toContain("不必每次都冷启");
expect(ios).toContain("不要重新探索");
expect(ios).toContain("## 6. 路由与经验");
});
test("3 平台配方 + 控制面下发的历史路由都渲染进去", () => {
expect(ios).toContain("MTLJSONAdapter");
expect(ios).toContain("PHPhotoLibrary");
expect(ios).toContain("我 → 精选 New");
expect(android).toContain("API_URL_HEADER");
expect(android).not.toContain("PHPhotoLibrary");
expect(android).toContain("还没有同平台的历史路由");
expect(ios).not.toMatch(/\{\{\w+\}\}/);
});
test("4 长语言对照放最后集中做", () => {
expect(ios).toContain("待走:<语言>对照");
expect(ios).toContain("规约要求多种语言时");
expect(ios).toContain("主语言之外的语言放到最后集中走");
});
test("5 测试账号进规约,禁止登录规约外的账号", () => {
expect(ios).toContain("空账号:138xxxx");
expect(ios).toContain("禁止登录规约「可用测试账号」之外的账号");
});
test("6 同名重拍用 --replace;大仓查代码先缩小目录", () => {
expect(ios).toContain("--replace");
expect(ios).toContain("git ls-tree -r --name-only");
});
test("影响范围:用例验证的 prompt 里没有这些", () => {
const caseRun = buildVerificationFirstPrompt(verification({
verifySpec: JSON.stringify({ format: "case-run", scope: "", cases: { source: { kind: "agent-session" }, title: "t", cases: [] } }),
}), WS);
for (const s of ["已知路由与做法", "HANDOFF", "MTLJSONAdapter", "sips -Z", "## 6. 路由与经验"]) expect(caseRun).not.toContain(s);
});
});
describe("路由与经验:解析 → 汇总 → 渲染", () => {
const md = UI_AUDIT_REPORT_SKELETON
.replace("| 页面 | <lang1> | <lang2> | … |", "| 页面 | en |")
.replace("|---|---|---|---|\n| `s1-<面>/01-<页面>` | ✅ | ⚠ | … |", "|---|---|\n| `s1-dm/01-inbox` | ✅ |")
.replace(/\| `s1-settings\/05-language` \| 语言设置 \| <[^\n]*\|/, "| `s1-profile/14-story-archive` | Story 归档 | 我 → 精选 New → 右上归档 |")
.replace(/\| <例:列表空态\(iOS\)> \|[^\n]*\|/, "| 列表空态(iOS) | hook MTLJSONAdapter 清空列表字段 |");
const r = parseAuditReport(md)!;
test("第 6 节两张表按表头分开,占位行丢掉", () => {
expect(r.routes).toEqual([{ page: "s1-profile/14-story-archive", title: "Story 归档", how: "我 → 精选 New → 右上归档" }]);
expect(r.recipes).toEqual([{ scene: "列表空态(iOS)", how: "hook MTLJSONAdapter 清空列表字段" }]);
expect(r.pages.some((p) => p.id === "s1-profile/14-story-archive")).toBe(false); // 第 6 节的表不混进逐页问题
});
test("汇总:新的覆盖旧的", () => {
const k = mergeAuditKnowledge([
{ routes: [{ page: "a", title: "新", how: "新路" }] },
{ routes: [{ page: "a", title: "旧", how: "旧路" }, { page: "b", title: "B", how: "b" }] },
]);
expect(k.routes.map((x) => x.how)).toEqual(["新路", "b"]);
expect(renderAuditKnowledge(k, 2)).toContain("最近 2 份报告");
expect(renderAuditKnowledge({ routes: [], recipes: [] })).toBe("");
});
});
describe("上下文体量与 iOS 基线", () => {
test("只认主会话的 usage,子 Agent 的不算", () => {
const main = JSON.stringify({ type: "assistant", parent_tool_use_id: null, message: { usage: { input_tokens: 10, cache_read_input_tokens: 250000, cache_creation_input_tokens: 2000 } } });
const sub = JSON.stringify({ type: "assistant", parent_tool_use_id: "toolu_x", message: { usage: { input_tokens: 5, cache_read_input_tokens: 9000 } } });
expect(lastMainContextTokens(`${main}\n${sub}\n`)).toBe(252010);
expect(lastMainContextTokens("")).toBeNull();
});
test("cat-supervisor 实例:正在跑的优先", () => {
const j = JSON.stringify({ instances: [
{ id: "tiktokm-1", app: "/a/1.app", state: "stopped" },
{ id: "tiktokm-3", app: "/a/3.app", state: "running", version: "47.3.0 (473000)" },
] });
expect(pickCatInstance(j)?.id).toBe("tiktokm-3");
expect(pickCatInstance("not json")).toBeNull();
});
});
describe("00889383 暴露的四处契约漂移,解析器兜住", () => {
const md = [
"# t", "", "## 1. 汇总", "", "## 2. 覆盖矩阵", "", "| 页面 | en |", "|---|---|",
"| `s3-dm/01-inbox` | ⚠ |", "| `s3-dm/02-chat` | ✅ |", "",
"## 3. 未覆盖 / BLOCKED(不计为通过)", "", "| 范围 | 状态 | 原因 / 已做到哪一步 |", "|---|---|---|",
"| 群聊会话页 | 已覆盖 | 已采 s3-dm/27 |", "| 服务端错误态 | BLOCKED(环境) | response_mock 不生效 |", "",
"## 4. 逐页问题与截图", "", "### 面 3 · DM", "", "#### `s3-dm/01-inbox` · 收件箱", "",
"| # | 严重度 | 类别 | 语言 | 现象 | 细节 | 代码位置 |", "|---|---|---|---|---|---|---|",
"| 1 | P2 | 热区 | en | 「…」只有 24pt。 | — | — |", "",
"## 5. 状态构造记录", "", "| 页面 | 怎么造的 | 脚本 |", "|---|---|---|", "| `s3-dm/01-inbox` | 断网 | — |", "",
"说明文件:", "", "| 文件 | 作用 |", "|---|---|", "| evidence/flow-r1-x.png | 截图 |", "",
].join("\n");
const r = parseAuditReport(md)!;
test("第 3 节里「已覆盖」的行不算阻塞", () => {
expect(r.blocked.map((b) => b.cause)).toEqual(["env"]);
});
test("第 5 节只认「页面」那张表", () => {
expect(r.constructed!.map((c) => c.page)).toEqual(["s3-dm/01-inbox"]);
});
test("覆盖矩阵补进来的页面并到同序号的全名面上", () => {
expect([...new Set(r.pages.map((p) => p.surface))]).toEqual(["面 3 · DM"]);
});
test(".ui.txt 前面有说明 / Frida 树时,中段的 uiautomator XML 照样认", () => {
const xml = '<hierarchy rotation="0"><node index="0" text="Inbox" resource-id="" class="android.widget.TextView" clickable="true" bounds="[0,0][1080,200]" /></hierarchy>';
const t = parseUiTree(`# structure tree\n# --- part A: Frida ---\n### ROOT ...\n# --- part B ---\n${xml}`);
expect(t?.units).toBe("px");
expect(t?.elements.length).toBeGreaterThan(0);
});
});
describe("共享自定义专项", () => {
test("和内置专项一样按 id 展开成【类别】全文", () => {
const custom = [{ id: "custom-1", label: "Toast 两行", cat: "文案与多语言", text: "Toast 超过两行" }];
expect(checksFromPresets(["custom-1", "hit-area-spec"], custom)).toEqual([
"【文案与多语言】Toast 超过两行",
`【热区】${UI_AUDIT_CHECK_PRESETS.find((p) => p.id === "hit-area-spec")!.text}`,
]);
expect(checksFromPresets(["custom-1"])).toEqual([]);
});
test("类别只能取报告词表里的六个词,名称和内容不能空", () => {
expect(validateCustomCheck({ label: " a ", cat: "热区", text: " b " })).toEqual({ label: "a", cat: "热区", text: "b" });
expect(typeof validateCustomCheck({ label: "a", cat: "自创类别", text: "b" })).toBe("string");
expect(typeof validateCustomCheck({ label: "", cat: "热区", text: "b" })).toBe("string");
expect(typeof validateCustomCheck({ label: "a", cat: "热区", text: "" })).toBe("string");
expect(typeof validateCustomCheck(null)).toBe("string");
});
});