diff --git a/__tests__/components/shared/sprint-switcher.test.tsx b/__tests__/components/shared/sprint-switcher.test.tsx index 8b1e2ec..a9639fd 100644 --- a/__tests__/components/shared/sprint-switcher.test.tsx +++ b/__tests__/components/shared/sprint-switcher.test.tsx @@ -15,6 +15,7 @@ vi.mock('next/navigation', () => ({ vi.mock('@/actions/active-sprint', () => ({ setActiveSprintAction: vi.fn(), + switchActiveSprintAction: vi.fn(), })) vi.mock('sonner', () => ({ @@ -22,9 +23,25 @@ vi.mock('sonner', () => ({ })) const isDemoMock = { value: false } +// Mock-state shape moet alle paden dekken die SprintSwitcher selecteert: +// - s.context.isDemo (oude code) +// - s.entities.settings.workflow?.pendingSprintDraft?.[productId]?.goal (PBI-79) +type MockStoreState = { + context: { isDemo: boolean } + entities: { + settings: { + workflow?: { + pendingSprintDraft?: Record + } + } + } +} vi.mock('@/stores/user-settings/store', () => ({ - useUserSettingsStore: (selector: (s: { context: { isDemo: boolean } }) => unknown) => - selector({ context: { isDemo: isDemoMock.value } }), + useUserSettingsStore: (selector: (s: MockStoreState) => unknown) => + selector({ + context: { isDemo: isDemoMock.value }, + entities: { settings: {} }, + }), })) vi.mock('@/components/ui/dropdown-menu', () => { @@ -54,11 +71,11 @@ vi.mock('@/components/ui/tooltip', () => { } }) -import { setActiveSprintAction } from '@/actions/active-sprint' +import { switchActiveSprintAction } from '@/actions/active-sprint' import { toast } from 'sonner' import { SprintSwitcher } from '@/components/shared/sprint-switcher' -const actionMock = setActiveSprintAction as unknown as ReturnType +const actionMock = switchActiveSprintAction as unknown as ReturnType const toastError = toast.error as unknown as ReturnType const toastSuccess = toast.success as unknown as ReturnType