P1-6 useStyleLearn/useKimiOauth 修 stale-closure 依赖。 P1-7 CommandPalette/Drawer 加 focus trap(新 lib/a11y/focusTrap)。 P1-8 SSE 解析与 server.ts 去 as 强转改类型守卫/运行时校验。 P2 删冗余强转、开 noUncheckedIndexedAccess、Toast 清理+稳定 key、列表 key 稳定化、 rel=noopener、useMemo 大文本、ConflictCard role=group、useInjection 加锁、 client.test 真断言。 codegen 重生成 schema.d.ts + 消费 DimensionEntry/ReviewConflictView 强类型。
29 lines
851 B
TypeScript
29 lines
851 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { aiToolItems } from "./ai-tools";
|
|
|
|
describe("aiToolItems", () => {
|
|
it("returns 5 items", () => {
|
|
expect(aiToolItems("p1")).toHaveLength(5);
|
|
});
|
|
|
|
it("leads with 写本章 (primary, key write)", () => {
|
|
const [first] = aiToolItems("p1");
|
|
expect(first?.label).toBe("写本章");
|
|
expect(first?.primary).toBe(true);
|
|
expect(first?.key).toBe("write");
|
|
});
|
|
|
|
it("scopes every href under the project path", () => {
|
|
for (const item of aiToolItems("abc")) {
|
|
expect(item.href.startsWith("/projects/abc/")).toBe(true);
|
|
}
|
|
});
|
|
|
|
it("maps 审稿 to the review page and key", () => {
|
|
const review = aiToolItems("p1").find((item) => item.label === "审稿");
|
|
expect(review?.href).toBe("/projects/p1/review");
|
|
expect(review?.key).toBe("review");
|
|
});
|
|
});
|