test: tighten browser doctor warning assertion

This commit is contained in:
Shakker
2026-05-08 20:45:03 +01:00
parent 150ded8f27
commit f0dfabfc38

View File

@@ -8,6 +8,15 @@ vi.mock("../plugin-sdk/facade-loader.js", () => ({
loadBundledPluginPublicSurfaceModuleSync,
}));
function requireFirstNoteCall(noteFn: ReturnType<typeof vi.fn>): unknown[] {
const call = noteFn.mock.calls[0];
expect(call).toBeDefined();
if (!call) {
throw new Error("expected browser doctor note");
}
return call;
}
describe("doctor browser facade", () => {
beforeEach(() => {
loadBundledPluginPublicSurfaceModuleSync.mockReset();
@@ -45,8 +54,9 @@ describe("doctor browser facade", () => {
await expect(noteChromeMcpBrowserReadiness({}, { noteFn })).resolves.toBeUndefined();
expect(noteFn).toHaveBeenCalledTimes(1);
expect(String(noteFn.mock.calls[0]?.[0])).toContain("Browser health check is unavailable");
expect(String(noteFn.mock.calls[0]?.[0])).toContain("missing browser doctor facade");
expect(noteFn.mock.calls[0]?.[1]).toBe("Browser");
const noteCall = requireFirstNoteCall(noteFn);
expect(String(noteCall[0])).toContain("Browser health check is unavailable");
expect(String(noteCall[0])).toContain("missing browser doctor facade");
expect(noteCall[1]).toBe("Browser");
});
});