Build plan-shape test data with the typed factories

PlanResults, Plan and usePlanProposal still hand-rolled proposal objects
inline -- roughly 29 nested literals in PlanResults alone. Hand-writing a
deep shape is the pressure that produced 219 `as any` casts across this
suite, so the factories existing but going unused left the trap armed.

Values an assertion depends on stay inline as overrides; the factories
supply only the scaffolding a reader does not need to see. A type gaining
a field now breaks one factory instead of silently passing thirty tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RXMhc9nT6sNz1SL4j8dznL
This commit is contained in:
2026-09-15 07:47:25 +02:00
parent fe120ee222
commit 46e89a4359
3 changed files with 327 additions and 359 deletions
+2 -9
View File
@@ -2,18 +2,11 @@ import { describe, it, expect, beforeEach, vi } from 'vitest'
import { renderHook, act } from '@testing-library/react'
import { usePlanProposal } from './usePlanProposal'
import * as api from '@/services/api'
import { makePlanProposal } from '../../tests/fixtures'
vi.mock('@/services/api')
const mockProposal = {
days: [],
outcomes: [],
warnings: [],
poolBalances: [],
vacationBalances: [],
surplusAdvice: [],
age4Projections: [],
}
const mockProposal = makePlanProposal()
describe('usePlanProposal', () => {
beforeEach(() => {