From b11308cf00da92fa7fb9fbc10440170dc3b7cd66 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Sat, 31 Oct 2026 07:13:03 -0700 Subject: [PATCH] Repair project grouping typed integration fixtures --- ...le-web-shell-nested-project-filter.test.ts | 1 + .../project-grouping-peer-roundtrip.test.ts | 16 ++++--- .../RepositoryRemoveProjectButton.tsx | 2 +- ...sitory-source-control-ai-global-ux.test.ts | 3 +- .../SidebarRepositoryFilterSection.test.tsx | 4 +- .../host-section-project-preparation.test.ts | 2 +- .../project-group-actions-test-fixtures.ts | 15 +++++-- .../qualified-group-actions-lifetime.test.tsx | 2 +- .../qualified-group-actions-scaling.test.tsx | 9 ++-- .../sidebar/qualified-group-actions.test.tsx | 44 +++++++------------ ...lified-notice-shipping-boundaries.test.tsx | 25 ++++++++++- .../rows/use-project-group-dialogs.ts | 2 +- ...ask-page-concrete-source-controls.test.tsx | 5 ++- .../src/store/repos/repo-removal.test.ts | 2 +- ...oject-grouping-authenticated-peers.test.ts | 9 +++- 15 files changed, 88 insertions(+), 53 deletions(-) diff --git a/mobile/src/mobile-web-shell/mobile-web-shell-nested-project-filter.test.ts b/mobile/src/mobile-web-shell/mobile-web-shell-nested-project-filter.test.ts index f1b4c77bb95..fa591fdfd1c 100644 --- a/mobile/src/mobile-web-shell/mobile-web-shell-nested-project-filter.test.ts +++ b/mobile/src/mobile-web-shell/mobile-web-shell-nested-project-filter.test.ts @@ -25,6 +25,7 @@ import { WORKSPACE_OPTION_CONTROLS } from '../host-screen/workspace-option-contr import { projectHostSetupProjectionFromRepos } from '../../../src/shared/project-host-setup-projection' import { buildFilterRepos } from '../worktree/workspace-filter-repos' import type { HostScreenController } from '../host-screen/use-host-screen-controller' +// Keep the integration bound for real encrypted RPC, held ACKs and persisted-state settlement. it('joins normally published nested Hx through the actual Projects pending writer and marked owner', async () => { const acknowledgements: (() => void)[] = [] const owner = await createProjectGroupingSocketOwner({ diff --git a/src/main/persistence/applying-settings/project-grouping-peer-roundtrip.test.ts b/src/main/persistence/applying-settings/project-grouping-peer-roundtrip.test.ts index 5e473c670c8..8442bc888a1 100644 --- a/src/main/persistence/applying-settings/project-grouping-peer-roundtrip.test.ts +++ b/src/main/persistence/applying-settings/project-grouping-peer-roundtrip.test.ts @@ -20,7 +20,13 @@ import { afterEach, beforeEach, expect, it, vi } from 'vitest' import { mkdtempSync, rmSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' -import { closeTestStores, createStore, readDataFile, testState } from '../persistence-test-harness' +import { + closeTestStores, + createStore, + readDataFile, + readPersistedState, + testState +} from '../persistence-test-harness' import { RpcDispatcher } from '../../runtime/rpc/dispatcher' import { CLIENT_UI_METHODS } from '../../runtime/rpc/methods/client-ui' import { RUNTIME_CLIENT_CAPABILITY_METHODS } from '../../runtime/rpc/methods/runtime-client-capabilities' @@ -331,7 +337,7 @@ it('saves the actual nested Hx edit exactly through native and marked RPC owners electron.handlers.get('ui:set')!({}, { filterRepoIds: edited }) expect(store.getUI().filterRepoIds).toEqual(edited) store.flush() - expect(readDataFile().ui.filterRepoIds).toEqual(edited) + expect(readPersistedState().ui.filterRepoIds).toEqual(edited) const runtime = new OrcaRuntimeService(store) const dispatcher = new RpcDispatcher({ runtime, @@ -384,7 +390,7 @@ it('saves the actual nested Hx edit exactly through native and marked RPC owners unresolved: ['offline'] }) store.flush() - expect(readDataFile().ui.filterRepoIds).toEqual(edited) + expect(readPersistedState().ui.filterRepoIds).toEqual(edited) await closeTestStores() const restored = createStore().getUI().filterRepoIds // Hydration may prune absent literal raw ids; the existing qualified physical address survives while r exists. @@ -447,12 +453,12 @@ it.each([100, 1000])( expect(writes.mock.calls.at(-1)?.[0].filterRepoIds).toEqual(produced) expect(store.getUI().filterRepoIds).toEqual(produced) store.flush() - expect(readDataFile().ui.filterRepoIds).toEqual(produced) + expect(readPersistedState().ui.filterRepoIds).toEqual(produced) const matches = projectRepoFilterMatcher(store.getUI().filterRepoIds) const included = authored.filter((repo) => matches(repo.id, repo.executionHostId)) expect(included).toEqual(authored.slice(0, q)) process.stdout.write( - `F1 owner ${JSON.stringify({ n, q, sends: writes.mock.calls.length - before, returned: response.ok, savedTokens: readDataFile().ui.filterRepoIds.length, included: included.length })}\n` + `F1 owner ${JSON.stringify({ n, q, sends: writes.mock.calls.length - before, returned: response.ok, savedTokens: readPersistedState().ui.filterRepoIds.length, included: included.length })}\n` ) } writes.mockRestore() diff --git a/src/renderer/src/components/settings/repository/RepositoryRemoveProjectButton.tsx b/src/renderer/src/components/settings/repository/RepositoryRemoveProjectButton.tsx index 9f1533d3bed..71c321cde2b 100644 --- a/src/renderer/src/components/settings/repository/RepositoryRemoveProjectButton.tsx +++ b/src/renderer/src/components/settings/repository/RepositoryRemoveProjectButton.tsx @@ -107,7 +107,7 @@ export function prepareSettingsProjectRemoval( members.push(member) } } - const recipeHosts = new Set( + const recipeHosts = new Set( state.runtimeEnvironments.flatMap((environment) => { const host = toRuntimeExecutionHostId(environment.id) return getRecipeVmSshTargetForHost([environment], host) ? [host] : [] diff --git a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux.test.ts b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux.test.ts index cb23472b469..3ee6e890d49 100644 --- a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux.test.ts +++ b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux.test.ts @@ -57,6 +57,7 @@ describe('useRepositorySourceControlAiGlobalUx', () => { return originalQueue(options) }) const available = { ...withRecipe('original'), enabled: false } + const initialProps: { snapshot: RepoSourceControlAiOverrides | null } = { snapshot: available } const updateRepo = vi.fn().mockResolvedValue(true) type Ux = ReturnType let onCommit: ((ux: Ux) => void) | undefined @@ -77,7 +78,7 @@ describe('useRepositorySourceControlAiGlobalUx', () => { }) return ux }, - { initialProps: { snapshot: available } } + { initialProps } ) try { act(() => { diff --git a/src/renderer/src/components/sidebar/SidebarRepositoryFilterSection.test.tsx b/src/renderer/src/components/sidebar/SidebarRepositoryFilterSection.test.tsx index 68a049d83d9..d75ea4cbfbd 100644 --- a/src/renderer/src/components/sidebar/SidebarRepositoryFilterSection.test.tsx +++ b/src/renderer/src/components/sidebar/SidebarRepositoryFilterSection.test.tsx @@ -15,7 +15,7 @@ import { registerUIHandlers } from '../../../../main/ipc/ui' import { createStore, closeTestStores, - readDataFile, + readPersistedState, testState, writeDataFile } from '../../../../main/persistence/persistence-test-harness' @@ -686,7 +686,7 @@ it('completes the actual adopted nested Hx in Projects without borrowing Hy from expect(setFilterRepoIds).toHaveBeenLastCalledWith(['offline', 'ssh:x\0r']) expect(store.getUI().filterRepoIds).toEqual(['offline', 'ssh:x\0r']) store.flush() - expect(readDataFile().ui.filterRepoIds).toEqual(['offline', 'ssh:x\0r']) + expect(readPersistedState().ui.filterRepoIds).toEqual(['offline', 'ssh:x\0r']) const rows = [ { id: 'r', host: 'ssh:x' as const, name: 'wx' }, { id: 'r', host: 'ssh:y' as const, name: 'wy' }, diff --git a/src/renderer/src/components/sidebar/host-section-project-preparation.test.ts b/src/renderer/src/components/sidebar/host-section-project-preparation.test.ts index a15d7b2d1f7..32adae20b1b 100644 --- a/src/renderer/src/components/sidebar/host-section-project-preparation.test.ts +++ b/src/renderer/src/components/sidebar/host-section-project-preparation.test.ts @@ -613,7 +613,7 @@ it('retains own display and original beta-first context when host-mode ordering { ...worktree, id: 'alpha-main', repoId: 'same', hostId: 'ssh:gpu-vm' } ], { - repoMap: new Map([ + repoMap: new Map([ [local.id, local], [sshBeta.id, sshBeta] ]), diff --git a/src/renderer/src/components/sidebar/project-group-actions-test-fixtures.ts b/src/renderer/src/components/sidebar/project-group-actions-test-fixtures.ts index bfbda09f1ad..8d08d592e47 100644 --- a/src/renderer/src/components/sidebar/project-group-actions-test-fixtures.ts +++ b/src/renderer/src/components/sidebar/project-group-actions-test-fixtures.ts @@ -1,4 +1,5 @@ import type { Store } from '../../../../main/persistence' +import { ProjectGroupMoveProjectArgs } from '../../../../main/ipc/repos/repo-ipc-arg-schemas' import type { ProjectHostSetup } from '../../../../shared/project-types' import type { Repo } from '../../../../shared/repo-types' import type userEvent from '@testing-library/user-event' @@ -103,7 +104,7 @@ export async function groupActionFixture(input: { ) } const createLocal = vi.fn(async (args) => - localDisk.createProjectGroup(args) + localDisk.createProjectGroup({ ...args, createdFrom: args.createdFrom ?? 'manual' }) ) const createRemote = vi.fn((name: string) => remoteDisk.createProjectGroup({ name, createdFrom: 'manual' }) @@ -115,18 +116,24 @@ export async function groupActionFixture(input: { projectGroups: { ...window.api?.projectGroups, create: createLocal, - moveProject: async (args: Parameters[0]) => - receivingMove('local', localDisk, { + moveProject: async ( + input: Parameters[0] + ) => { + const args = ProjectGroupMoveProjectArgs.parse(input) + return receivingMove('local', localDisk, { id: args.projectId, hostId: args.hostId, groupId: args.groupId, order: args.order }) + } }, runtimeEnvironments: { ...window.api?.runtimeEnvironments, call: async (request: Parameters[0]) => { - const compatible = createCompatibleRuntimeStatusResponseIfNeeded(request) + const compatible = createCompatibleRuntimeStatusResponseIfNeeded({ + method: request.method + }) if (compatible) { return compatible } diff --git a/src/renderer/src/components/sidebar/qualified-group-actions-lifetime.test.tsx b/src/renderer/src/components/sidebar/qualified-group-actions-lifetime.test.tsx index e3413ecffbd..e32566adc81 100644 --- a/src/renderer/src/components/sidebar/qualified-group-actions-lifetime.test.tsx +++ b/src/renderer/src/components/sidebar/qualified-group-actions-lifetime.test.tsx @@ -279,7 +279,7 @@ it('completes row New through the existing list dialog lifetime while its first render() await user.pointer({ target: screen.getByText('b checkout'), keys: '[MouseRight]' }) await user.click(screen.getByRole('menuitem', { name: 'New group from project' })) - await user.click(screen.getByRole('button', { name: 'Create', exact: true })) + await user.click(screen.getByRole('button', { name: 'Create' })) await waitFor(() => expect(fixture.moves).toHaveLength(3)) await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull()) expect(fixture.createLocal).toHaveBeenCalledTimes(1) diff --git a/src/renderer/src/components/sidebar/qualified-group-actions-scaling.test.tsx b/src/renderer/src/components/sidebar/qualified-group-actions-scaling.test.tsx index 200f55430fa..644877c2442 100644 --- a/src/renderer/src/components/sidebar/qualified-group-actions-scaling.test.tsx +++ b/src/renderer/src/components/sidebar/qualified-group-actions-scaling.test.tsx @@ -217,10 +217,11 @@ it('refreshes the open selected operation and predicates together, with equal/un worktree: { ...worktree, repoId: 'a', hostId: 'local' } } let commits = 0 - let selected: ReturnType = null + const observed: { selected: ReturnType } = { selected: null } const resolver = vi.spyOn(groupOperations, 'resolveProjectGroupOperation') function Probe() { - selected = useProjectGroupOperation(true, entrance) + const selected = useProjectGroupOperation(true, entrance) + observed.selected = selected useLayoutEffect(() => { commits++ }) @@ -271,8 +272,8 @@ it('refreshes the open selected operation and predicates together, with equal/un })) ) expect(commits).toBe(2) - expect(selected?.grouped).toBe(true) - expect(selected?.uniformGroupId).toBeUndefined() + expect(observed.selected?.grouped).toBe(true) + expect(observed.selected?.uniformGroupId).toBeUndefined() act(() => useAppStore.setState((state) => ({ projectGroups: state.projectGroups.map((group) => diff --git a/src/renderer/src/components/sidebar/qualified-group-actions.test.tsx b/src/renderer/src/components/sidebar/qualified-group-actions.test.tsx index d30953b1a59..cfafe651ec4 100644 --- a/src/renderer/src/components/sidebar/qualified-group-actions.test.tsx +++ b/src/renderer/src/components/sidebar/qualified-group-actions.test.tsx @@ -159,13 +159,10 @@ it('uses the actual runtime host-copy New dialog once and retains its ID on fail }) const quiet = vi.spyOn(console, 'error').mockImplementation(() => {}) try { - await user.click(screen.getByRole('button', { name: 'Create', exact: true })) + await user.click(screen.getByRole('button', { name: 'Create' })) await waitFor(() => expect(fixture.moves).toHaveLength(2)) await waitFor(() => - expect(screen.getByRole('button', { name: 'Create', exact: true })).toHaveProperty( - 'disabled', - false - ) + expect(screen.getByRole('button', { name: 'Create' })).toHaveProperty('disabled', false) ) expect(screen.getByRole('dialog')).toBeTruthy() expect(fixture.createRemote).toHaveBeenCalledTimes(1) @@ -174,7 +171,7 @@ it('uses the actual runtime host-copy New dialog once and retains its ID on fail expect(fixture.remoteDisk.getRepo('c')?.projectGroupId).toBe(created.id) expect(fixture.remoteDisk.getRepo('d')?.projectGroupId ?? null).toBeNull() failD = false - await user.click(screen.getByRole('button', { name: 'Create', exact: true })) + await user.click(screen.getByRole('button', { name: 'Create' })) await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull()) expect(fixture.createRemote).toHaveBeenCalledTimes(1) expect(fixture.moves.map((move) => move.id)).toEqual(['c', 'd', 'd', 'e']) @@ -249,15 +246,12 @@ it('keeps row New bound to its captured own name and draft through foreign, equa }) } }) - await user.click(screen.getByRole('button', { name: 'Create', exact: true })) + await user.click(screen.getByRole('button', { name: 'Create' })) await waitFor(() => expect(release).toBeTypeOf('function')) publishForeignName('Latest Quay') expect(screen.getByRole('dialog')).toBe(dialog) expect(input).toHaveProperty('value', 'My Harbor group') - expect(screen.getByRole('button', { name: 'Saving...', exact: true })).toHaveProperty( - 'disabled', - true - ) + expect(screen.getByRole('button', { name: 'Saving...' })).toHaveProperty('disabled', true) expect(fixture.createLocal).toHaveBeenCalledTimes(1) expect(fixture.createLocal).toHaveBeenCalledWith( expect.objectContaining({ name: 'My Harbor group' }) @@ -429,10 +423,10 @@ it('fences an old card New continuation and dialog completion when closed and re await user.click(screen.getByRole('menuitem', { name: 'New group from project' })) await user.clear(screen.getByRole('textbox', { name: 'Group Name' })) await user.type(screen.getByRole('textbox', { name: 'Group Name' }), 'Old row draft') - await user.click(screen.getByRole('button', { name: 'Create', exact: true })) + await user.click(screen.getByRole('button', { name: 'Create' })) await waitFor(() => expect(release).toBeTypeOf('function')) const oldGroup = fixture.createLocal.mock.results[0]!.value - await user.click(screen.getByRole('button', { name: 'Cancel', exact: true })) + await user.click(screen.getByRole('button', { name: 'Cancel' })) await user.click(screen.getByRole('button', { name: 'Project actions for Harbor' })) await user.click(screen.getByRole('menuitem', { name: 'New group from project' })) const successor = screen.getByRole('dialog') @@ -451,15 +445,12 @@ it('fences an old card New continuation and dialog completion when closed and re 'value', 'Successor group' ) - expect(screen.getByRole('button', { name: 'Create', exact: true })).toHaveProperty( - 'disabled', - false - ) + expect(screen.getByRole('button', { name: 'Create' })).toHaveProperty('disabled', false) expect(fixture.moves.map((move) => move.id)).toEqual(['a']) expect(fixture.localDisk.getRepo('b')?.projectGroupId ?? null).toBeNull() expect(oldGroup).toBeDefined() fixture.intercept() - await user.click(screen.getByRole('button', { name: 'Create', exact: true })) + await user.click(screen.getByRole('button', { name: 'Create' })) await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull()) expect(fixture.createLocal).toHaveBeenCalledTimes(2) expect(fixture.createLocal.mock.calls.map(([args]) => args.name)).toEqual([ @@ -487,30 +478,27 @@ it('prevalidates finite original sources before New, keeps create failure in the act(() => useAppStore.setState((state) => ({ repos: state.repos.filter((entry) => entry.id !== 'b') })) ) - await user.click(screen.getByRole('button', { name: 'Create', exact: true })) + await user.click(screen.getByRole('button', { name: 'Create' })) expect(fixture.createLocal).not.toHaveBeenCalled() expect(fixture.moves).toEqual([]) expect(feedback).toHaveBeenCalledTimes(1) expect(screen.getByRole('dialog')).toBeTruthy() - await user.click(screen.getByRole('button', { name: 'Cancel', exact: true })) + await user.click(screen.getByRole('button', { name: 'Cancel' })) act(() => useAppStore.setState({ repos: fixture.repos })) fixture.createLocal.mockRejectedValueOnce(new Error('create disconnected')) await user.click(screen.getByRole('button', { name: 'Project actions for Harbor' })) await user.click(screen.getByRole('menuitem', { name: 'New group from project' })) - await user.click(screen.getByRole('button', { name: 'Create', exact: true })) + await user.click(screen.getByRole('button', { name: 'Create' })) await waitFor(() => - expect(screen.getByRole('button', { name: 'Create', exact: true })).toHaveProperty( - 'disabled', - false - ) + expect(screen.getByRole('button', { name: 'Create' })).toHaveProperty('disabled', false) ) - await user.click(screen.getByRole('button', { name: 'Create', exact: true })) + await user.click(screen.getByRole('button', { name: 'Create' })) expect(fixture.createLocal).toHaveBeenCalledTimes(1) expect(fixture.moves).toEqual([]) - await user.click(screen.getByRole('button', { name: 'Cancel', exact: true })) + await user.click(screen.getByRole('button', { name: 'Cancel' })) await user.click(screen.getByRole('button', { name: 'Project actions for Harbor' })) await user.click(screen.getByRole('menuitem', { name: 'New group from project' })) - await user.click(screen.getByRole('button', { name: 'Create', exact: true })) + await user.click(screen.getByRole('button', { name: 'Create' })) await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull()) expect(fixture.createLocal).toHaveBeenCalledTimes(2) expect((await fixture.saved()).local[0]?.projectGroupId).toBe( diff --git a/src/renderer/src/components/sidebar/qualified-notice-shipping-boundaries.test.tsx b/src/renderer/src/components/sidebar/qualified-notice-shipping-boundaries.test.tsx index 32e43f6add8..5d1da3f217b 100644 --- a/src/renderer/src/components/sidebar/qualified-notice-shipping-boundaries.test.tsx +++ b/src/renderer/src/components/sidebar/qualified-notice-shipping-boundaries.test.tsx @@ -13,10 +13,24 @@ import { EMPTY_RETIRED_NAME_REGISTRY } from '../../../../shared/worktree/retired import { projectHostSetupProjectionFromRepos } from '../../../../shared/project-host-setup-projection' import { expect, it, vi } from 'vitest' import type { AppState } from '@/store/types' +import type { Repo } from '../../../../shared/repo-types' import { useAppStore } from '@/store' import { getDefaultSettings } from '../../../../shared/constants' -import { getRepoExecutionHostId } from '../../../../shared/execution-host' +import { getRepoExecutionHostId, parseExecutionHostId } from '../../../../shared/execution-host' import { worktree } from './worktree-list-groups-test-fixtures' + +function hasConcreteRepoUpdates( + updates: Parameters[1] +): updates is Parameters[1] & Partial { + return ( + updates.sourceControlAi !== null && + updates.externalWorktreeVisibility !== null && + updates.agentWorktreeVisibility !== null && + updates.externalWorktreeDiscoverySuppressedAt !== null && + updates.ghAccount !== null + ) +} + it('keeps beta recoverable after its real Keep hidden action through the shipping merged header and one exact recovery list', async () => { const alpha = { ...local, @@ -36,6 +50,9 @@ it('keeps beta recoverable after its real Keep hidden action through the shippin hostId: 'local' }) const updateRepo = vi.fn(async (id, updates, options) => { + if (!hasConcreteRepoUpdates(updates)) { + throw new Error('This fixture expects concrete repo updates, not clear sentinels') + } useAppStore.setState((state) => ({ repos: state.repos.map((entry) => entry.id === id && getRepoExecutionHostId(entry) === (options?.hostId ?? 'local') @@ -231,7 +248,11 @@ it('routes the shipping merged Remove Project menu to current Settings scope and if (repoId === beta.id && failBeta) { throw new Error('beta host refused') } - disk.removeProjectForHost({ id: repoId, executionHostId: hostId }) + const host = parseExecutionHostId(hostId) + if (!host || host.id !== hostId) { + throw new Error('Expected the original exact execution host') + } + disk.removeProjectForHost({ id: repoId, executionHostId: host.id }) } ) Object.assign(window, { diff --git a/src/renderer/src/components/sidebar/worktree-list/rows/use-project-group-dialogs.ts b/src/renderer/src/components/sidebar/worktree-list/rows/use-project-group-dialogs.ts index 08b57017779..d5fd29cf007 100644 --- a/src/renderer/src/components/sidebar/worktree-list/rows/use-project-group-dialogs.ts +++ b/src/renderer/src/components/sidebar/worktree-list/rows/use-project-group-dialogs.ts @@ -128,7 +128,7 @@ export function useProjectGroupDialogs(args: { ) const handleSubmitProjectGroupName = useCallback( - async (name: string) => { + async (name: string): Promise => { if (!nameDialog) { return } diff --git a/src/renderer/src/components/task-page/task-page-concrete-source-controls.test.tsx b/src/renderer/src/components/task-page/task-page-concrete-source-controls.test.tsx index 2d638ba2e63..daf3471e49b 100644 --- a/src/renderer/src/components/task-page/task-page-concrete-source-controls.test.tsx +++ b/src/renderer/src/components/task-page/task-page-concrete-source-controls.test.tsx @@ -127,7 +127,10 @@ it.each(['github', 'gitlab'] as const)( failedCount: 0, githubUnavailable: false })) - const count = vi.fn(async () => ({ totalPages: 1 })) + const count = vi.fn(async () => ({ + totalCount: 0, + totalPages: 1 + })) const workItem: GitHubWorkItem = { id: 'issue:1', repoId: 'same', diff --git a/src/renderer/src/store/repos/repo-removal.test.ts b/src/renderer/src/store/repos/repo-removal.test.ts index 71f41cdfcde..c8d32949707 100644 --- a/src/renderer/src/store/repos/repo-removal.test.ts +++ b/src/renderer/src/store/repos/repo-removal.test.ts @@ -448,7 +448,7 @@ it.each(['refusal', 'unique', 'absence'] as const)( expect(f.survivors()).toEqual(['r/x', 'r/y', 'q/y']) expect(listPendingRuntimeRepoRemovals('E')).toEqual([]) const action = vi.mocked(toast.error).mock.calls.at(-1)?.[1]?.action - if (!action || !('onClick' in action)) { + if (!action || typeof action !== 'object' || !('onClick' in action)) { throw new Error('real unreachable toast must offer its action') } render(createElement('button', { onClick: action.onClick }, action.label)) diff --git a/src/renderer/src/web/project-grouping-authenticated-peers.test.ts b/src/renderer/src/web/project-grouping-authenticated-peers.test.ts index 4ba447f5cb0..7c38968f2ab 100644 --- a/src/renderer/src/web/project-grouping-authenticated-peers.test.ts +++ b/src/renderer/src/web/project-grouping-authenticated-peers.test.ts @@ -82,7 +82,14 @@ it.each(['web', 'mobile', 'old'] as const)( readonly OPEN: WebSocket['OPEN'] = 1 readyState: WebSocket['readyState'] = 1 bufferedAmount = 0 - send = vi.fn() + send = + vi.fn< + ( + data: Parameters[0], + optionsOrCallback?: Parameters[1] | Parameters[2], + callback?: Parameters[2] + ) => void + >() close = vi.fn() } const Q = 'runtime:server\0same'