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:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user