feat: expand intelligent investigation workspace
This commit is contained in:
@@ -11,6 +11,30 @@ const block = {
|
||||
}
|
||||
};
|
||||
describe("untrusted answer components", () => {
|
||||
it("keeps explicit UI phases and rejects invalid phase values", () => {
|
||||
expect(parseAnswerUiBlock(block)?.phase).toBeUndefined();
|
||||
expect(parseAnswerUiBlock({ ...block, phase: "process" })?.phase).toBe("process");
|
||||
expect(parseAnswerUiBlock({ ...block, phase: "final" })?.phase).toBe("final");
|
||||
expect(parseAnswerUiBlock({ ...block, phase: "other" })).toBeNull();
|
||||
expect(parseAnswerUiBlock({ ...block, phase: null })).toBeNull();
|
||||
});
|
||||
it("accepts controlled task semantics and result states without accepting arbitrary presentation code", () => {
|
||||
const result = { type: "Result", props: { title: "定位结果", summary: "3 根管道已定位,高亮未确认。", status: "partial", source: "地图工具回执" }, children: [] };
|
||||
const spec = {
|
||||
root: "root", elements: {
|
||||
root: { type: "Stack", props: { columns: "one", gap: "normal", intent: "response", density: "compact" }, children: ["section"] },
|
||||
section: { type: "Section", props: { title: "本次结果", description: null, role: "result" }, children: ["result"] },
|
||||
result
|
||||
}
|
||||
};
|
||||
expect(parseAnswerUiBlock({ ...block, spec })).not.toBeNull();
|
||||
for (const props of [
|
||||
{ ...result.props, status: "running" },
|
||||
{ ...result.props, css: "display:none" },
|
||||
{ ...result.props, onClick: "fetch('/write')" }
|
||||
]) expect(parseAnswerUiBlock({ ...block, spec: { ...spec, elements: { ...spec.elements, result: { ...result, props } } } })).toBeNull();
|
||||
expect(parseAnswerUiBlock({ ...block, spec: { root: "note", elements: { note: { ...block.spec.elements.note, props: { text: "高亮操作未提供。", tone: "warning", title: "能力限制" } } } } })).not.toBeNull();
|
||||
});
|
||||
it("accepts registered text and rejects arbitrary code, URLs and unknown components", () => {
|
||||
expect(parseAnswerUiBlock(block)).not.toBeNull();
|
||||
for (const node of [
|
||||
|
||||
Reference in New Issue
Block a user