From b6bf9700a9386c0a582c9481091cfe508fd14b27 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Thu, 10 Sep 2026 04:51:54 -0700 Subject: [PATCH] test(desktop): type the hoisted requestGateway mock so the pin test typechecks CI runs tsc on the test tree; the hoisted vi.fn had a zero-arg signature so mockImplementation with a (method) callback was rejected. --- .../src/app/settings/plugin-install-modal.test.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/app/settings/plugin-install-modal.test.tsx b/apps/desktop/src/app/settings/plugin-install-modal.test.tsx index 6b8ca1a0c5..6820c40595 100644 --- a/apps/desktop/src/app/settings/plugin-install-modal.test.tsx +++ b/apps/desktop/src/app/settings/plugin-install-modal.test.tsx @@ -4,7 +4,12 @@ import { MemoryRouter } from 'react-router' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' // The host tab lists installed plugins on mount; only an `install` action counts as installing. -const { requestGateway } = vi.hoisted(() => ({ requestGateway: vi.fn(async () => ({ plugins: [] })) })) +const { requestGateway } = vi.hoisted(() => ({ + requestGateway: vi.fn(async (_method: string, _params?: Record): Promise => ({ + plugins: [] + })) +})) + vi.mock('@/app/gateway/hooks/use-gateway-request', () => ({ useGatewayRequest: () => ({ requestGateway }) })) @@ -114,7 +119,7 @@ describe('Install from Git entry flow', () => { it('pins a custom install to a full commit SHA and refuses anything shorter', async () => { probePluginRepo.mockResolvedValue({ ok: true, agent: true, desktop: false, warnings: [] }) - requestGateway.mockImplementation(async (method: string) => + requestGateway.mockImplementation(async method => method === 'plugins.manage' ? { ok: true, plugin_name: 'plugin', plugins: [] } : { plugins: [] } ) renderFlow()