muse-agent-example/web/tests/交互/分析配置.test.ts
zizi ae02fd1732 前端:工作台页面、事件标签与旅程用例
- 上下文清单、任务列表与详情、恢复控制、运行观察、创作对话与消息流、正式变更决策面板、正文写作与候选审阅、资料研究等页面同步本轮后端能力。
- 事件标签表补齐后端事件类型;查询键与生成客户端随 HTTP 契约重新生成。
- 依赖调整后 lockfile 同步;交互用例与浏览器旅程 spec 一并更新。
- 证据:make 前端检查(lint + typecheck + Pi 工具桥 tsc)exit 0;make 前端测试 37 文件 / 120 用例通过。
2026-09-18 01:15:07 +08:00

32 lines
1.2 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 { afterEach, expect, it, vi } from "vitest";
import { 发起拆书 } from "../../src/功能/资料研究/数据";
afterEach(() => vi.unstubAllGlobals());
// @muse-case {"case_id":"O08-research-explicit-config","then":"空或空白配置本地拒绝且无POST,已明确配置原样传入分析请求,不使用默认"}
it("O08-research-explicit-config:分析配置必须明确指定", async () => {
const bodies: unknown[] = [];
const fetch = vi.fn(async (request: Request) => {
bodies.push(await request.json());
return new Response(JSON.stringify({ task_id: "task" }), {
headers: { "Content-Type": "application/json" },
});
});
vi.stubGlobal("fetch", fetch);
await expect(发起拆书("source", { config_id: "" })).rejects.toThrow(
"明确指定",
);
await expect(发起拆书("source", { config_id: " " })).rejects.toThrow(
"明确指定",
);
expect(fetch).not.toHaveBeenCalled();
await 发起拆书("source", {
config_id: "approved-analysis-config",
reason: "合成测试",
});
expect(bodies).toEqual([
expect.objectContaining({
config_id: "approved-analysis-config",
reason: "合成测试",
}),
]);
});