test: verify debug security callout text · openclaw/openclaw@831eebf
shakkernerd
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -25,6 +25,10 @@ function createProps(overrides: Partial<DebugProps> = {}): DebugProps {
|
25 | 25 | }; |
26 | 26 | } |
27 | 27 | |
| 28 | +function normalizedText(element: Element | null | undefined): string | undefined { |
| 29 | +return element?.textContent?.replace(/\s+/gu, " ").trim(); |
| 30 | +} |
| 31 | + |
28 | 32 | describe("renderDebug", () => { |
29 | 33 | beforeEach(async () => { |
30 | 34 | vi.stubGlobal("localStorage", createStorageMock()); |
@@ -61,7 +65,11 @@ describe("renderDebug", () => {
|
61 | 65 | if (!command) { |
62 | 66 | throw new Error("expected debug security audit command"); |
63 | 67 | } |
| 68 | +const callout = container.querySelector(".callout"); |
| 69 | +expect(callout?.classList.contains("warn")).toBe(true); |
| 70 | +expect(normalizedText(callout)).toBe( |
| 71 | +"安全审计: 1 个警告 · 2 条信息. 运行 openclaw security audit --deep 查看详情。", |
| 72 | +); |
64 | 73 | expect(command.textContent).toBe("openclaw security audit --deep"); |
65 | | -expect(container.textContent).toContain("安全审计"); |
66 | 74 | }); |
67 | 75 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。