Raise frontend branch coverage from 86.84% to 93.78%

Branches were the weakest metric and had the least headroom above the
85% floor. These are tests for decision paths that were genuinely
unexercised, not padding.

The largest gaps were systemic rather than per-file: the
`err instanceof Error ? ... : fallback` branch was untested across eight
data hooks, useVacationDays had no dedicated test file at all, and
Calendar.tsx's missing-workspace/child/personalData fallbacks were never
hit.

Left deliberately uncovered, with reasons: `?? fallback` guards whose
fallback cannot occur given how the value is constructed upstream, and
guards behind buttons that are disabled whenever the guard would matter.
Reaching those means calling handlers directly, which tests the test
rather than the app.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RXMhc9nT6sNz1SL4j8dznL
This commit is contained in:
2026-09-14 18:54:56 +02:00
parent 8869ea8e55
commit c5481a05f0
23 changed files with 1063 additions and 5 deletions
+13
View File
@@ -49,6 +49,19 @@ describe('useAnalytics', () => {
expect(result.current.error).toContain('API error')
})
it('falls back to a generic message when a non-Error value is thrown', async () => {
vi.mocked(api.getWorkspaceOverview).mockRejectedValue('some string failure')
const { result } = renderHook(() => useAnalytics('ws1', 'child1'))
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 0))
})
expect(result.current.error).toBe('Failed to fetch analytics')
expect(result.current.data).toBeNull()
})
it('does not fetch when workspaceId is null', () => {
vi.mocked(api.getWorkspaceOverview).mockResolvedValue({} as any)