Skip to content

Commit 73abe9e

Browse files
committed
test: dedupe control ui auto root mock reads
1 parent 8a6c18a commit 73abe9e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/gateway/control-ui.auto-root.http.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ async function withControlUiRoot<T>(fn: (tmp: string) => Promise<T>) {
3333
}
3434
}
3535

36+
function responseBody(end: ReturnType<typeof makeMockHttpResponse>["end"]) {
37+
return String(end.mock.calls[0]?.[0] ?? "");
38+
}
39+
3640
afterEach(() => {
3741
resolveControlUiRootSyncMock.mockReset();
3842
isPackageProvenControlUiRootSyncMock.mockReset();
@@ -56,7 +60,7 @@ describe("handleControlUiHttpRequest auto-detected root", () => {
5660

5761
expect(handled).toBe(true);
5862
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');");
6064
});
6165
});
6266

@@ -77,7 +81,7 @@ describe("handleControlUiHttpRequest auto-detected root", () => {
7781

7882
expect(handled).toBe(true);
7983
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");
8185
});
8286
});
8387

0 commit comments

Comments
 (0)