test: dedupe control ui auto root mock reads · openclaw/openclaw@73abe9e
steipete
·
2026-05-13
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -33,6 +33,10 @@ async function withControlUiRoot<T>(fn: (tmp: string) => Promise<T>) {
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
| 36 | +function responseBody(end: ReturnType<typeof makeMockHttpResponse>["end"]) { |
| 37 | +return String(end.mock.calls[0]?.[0] ?? ""); |
| 38 | +} |
| 39 | + |
36 | 40 | afterEach(() => { |
37 | 41 | resolveControlUiRootSyncMock.mockReset(); |
38 | 42 | isPackageProvenControlUiRootSyncMock.mockReset(); |
@@ -56,7 +60,7 @@ describe("handleControlUiHttpRequest auto-detected root", () => {
|
56 | 60 | |
57 | 61 | expect(handled).toBe(true); |
58 | 62 | expect(res.statusCode).toBe(200); |
59 | | -expect(String(end.mock.calls.at(0)?.[0] ?? "")).toBe("console.log('hi');"); |
| 63 | +expect(responseBody(end)).toBe("console.log('hi');"); |
60 | 64 | }); |
61 | 65 | }); |
62 | 66 | |
@@ -77,7 +81,7 @@ describe("handleControlUiHttpRequest auto-detected root", () => {
|
77 | 81 | |
78 | 82 | expect(handled).toBe(true); |
79 | 83 | expect(res.statusCode).toBe(200); |
80 | | -expect(String(end.mock.calls.at(0)?.[0] ?? "")).toBe("<html>fallback-hardlink</html>\n"); |
| 84 | +expect(responseBody(end)).toBe("<html>fallback-hardlink</html>\n"); |
81 | 85 | }); |
82 | 86 | }); |
83 | 87 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。