test(tui): drop an unjustified double cast; fix a stale mock comment
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) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JTHVxSu8AUgHRLvo1ntZ8H Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
91e08067dc
commit
21cf1bd6c3
1 changed files with 3 additions and 3 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue