From 21cf1bd6c339a80dbeb2a5909446541f9c0f2019 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Sun, 23 Aug 2026 22:43:38 -0400 Subject: [PATCH] test(tui): drop an unjustified double cast; fix a stale mock comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses review round 6 on #2099. Both nits were correct. - The proxy-fetch sentinel used `as unknown as typeof fetch`, which AGENTS.md forbids without justification — and none was needed here: an `async () => new Response("")` satisfies the fetch signature directly, so it is now annotated rather than asserted. - The mock's comment still told readers to override `h.proxyFetchResult`, the name from an earlier revision; the hook is `h.proxyFetchState.current`. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01JTHVxSu8AUgHRLvo1ntZ8H Signed-off-by: cliffhall --- clients/tui/__tests__/App.test.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clients/tui/__tests__/App.test.tsx b/clients/tui/__tests__/App.test.tsx index 74bb2d7a..397ece22 100644 --- a/clients/tui/__tests__/App.test.tsx +++ b/clients/tui/__tests__/App.test.tsx @@ -250,8 +250,8 @@ vi.mock("@inspector/core/mcp/node/index.js", () => ({ // Defaults to undefined — "no proxy configured", which is what the real one // returns with no proxy env var set, so `environment.fetch` stays unset and // the client falls back to the built-in fetch, exactly as before #2067. A - // test can point `h.proxyFetchResult` at a sentinel to exercise the other - // branch. + // test can point `h.proxyFetchState.current` at a sentinel to exercise the + // other branch. createProxyFetch: vi.fn(() => h.proxyFetchState.current), })); vi.mock("@inspector/core/react/useInspectorClient.js", () => ({ @@ -1635,7 +1635,7 @@ describe("App (OAuth result branches)", () => { // what makes InspectorClient's own wrappers compose OVER the proxy instead // of discarding it — delete it and TUI proxy support silently disappears // while every other test stays green. - const sentinel = (async () => new Response("")) as unknown as typeof fetch; + const sentinel: typeof fetch = async () => new Response(""); h.proxyFetchState.current = sentinel; await mount(oneHttp()); expect(h.clientInstances.length).toBeGreaterThan(0);