@@ -17,6 +17,11 @@ type ToolCall = {
|
17 | 17 | name: string; |
18 | 18 | arguments?: Record<string, unknown>; |
19 | 19 | }; |
| 20 | +type ToolCallMock = { |
| 21 | +mock: { |
| 22 | +calls: Array<[ToolCall]>; |
| 23 | +}; |
| 24 | +}; |
20 | 25 | |
21 | 26 | type ChromeMcpSessionFactory = Exclude< |
22 | 27 | Parameters<typeof setChromeMcpSessionFactoryForTest>[0], |
@@ -256,9 +261,9 @@ describe("chrome MCP page parsing", () => {
|
256 | 261 | name: "new_page", |
257 | 262 | arguments: { url: "about:blank", timeout: 5000 }, |
258 | 263 | }); |
259 | | -expect(session.client.callTool).not.toHaveBeenCalledWith( |
260 | | - expect.objectContaining({ name: "navigate_page" }), |
261 | | -); |
| 264 | +const callToolMock = session.client.callTool as unknown as ToolCallMock; |
| 265 | +const callNames = callToolMock.mock.calls.map(([call]) => call.name); |
| 266 | +expect(callNames).not.toContain("navigate_page"); |
262 | 267 | }); |
263 | 268 | |
264 | 269 | it("parses evaluate_script text responses when structuredContent is missing", async () => { |
@@ -654,12 +659,11 @@ describe("chrome MCP page parsing", () => {
|
654 | 659 | // intentionally no timeoutMs |
655 | 660 | }); |
656 | 661 | |
657 | | -expect(session.client.callTool).toHaveBeenCalledWith( |
658 | | -expect.objectContaining({ |
659 | | -name: "navigate_page", |
660 | | -arguments: expect.objectContaining({ timeout: 20_000 }), |
661 | | -}), |
662 | | -); |
| 662 | +const callToolMock = session.client.callTool as unknown as ToolCallMock; |
| 663 | +const navigateCall = callToolMock.mock.calls.find( |
| 664 | +([call]) => call.name === "navigate_page", |
| 665 | +)?.[0]; |
| 666 | +expect(navigateCall?.arguments?.timeout).toBe(20_000); |
663 | 667 | }); |
664 | 668 | |
665 | 669 | it("resets the Chrome MCP session when a navigate_page call hangs past the safety-net timeout", async () => { |
|