From be867919005fe379e949bc569ac9bd8bb3112990 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Thu, 3 Sep 2026 23:31:38 -0400 Subject: [PATCH] test: drop two double casts from the new App case (#2217) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot, and the repo's own rule against an unjustified `as unknown as`. The `useServers` cast was the more useful catch: removing it surfaced that the mock omitted `reorderServers` and `importSource`, so App code calling either would have read `undefined` with this test still passing type-check. The full result shape is supplied instead, matching the `mockServersWith` helper above. The client cast becomes an intersection — the instances are already typed `EventTarget`, so naming the test-only spy on top of that expresses what is needed without erasing the rest. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01VGbw6TezNWnXZSCSp7sqb4 Signed-off-by: cliffhall --- clients/web/src/App.test.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/clients/web/src/App.test.tsx b/clients/web/src/App.test.tsx index c6a2dd0d..659a0433 100644 --- a/clients/web/src/App.test.tsx +++ b/clients/web/src/App.test.tsx @@ -4258,7 +4258,9 @@ describe("App dedupes concurrent OAuth clears that share a storage key (#2217)", updateServer: updateServerSpy, updateServerSettings: updateServerSettingsSpy, removeServer: vi.fn(), - } as unknown as ReturnType); + reorderServers: vi.fn(), + importSource: vi.fn().mockResolvedValue({ servers: {} }), + }); }); afterEach(() => { @@ -4299,7 +4301,9 @@ describe("App dedupes concurrent OAuth clears that share a storage key (#2217)", await user.click(screen.getByText("connect")); await waitFor(() => expect(clientInstances).toHaveLength(1)); - const client = clientInstances[0] as unknown as { + // The instances are typed `EventTarget`; an intersection names the + // test-only spy without erasing that (Copilot). + const client = clientInstances[0] as EventTarget & { clearOAuthTokens: ReturnType; };