test: drop two double casts from the new App case (#2217)
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) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VGbw6TezNWnXZSCSp7sqb4 Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
0d81cf7e84
commit
be86791900
1 changed files with 6 additions and 2 deletions
|
|
@ -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<typeof useServers>);
|
||||
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<typeof vi.fn>;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue