Require a planned day to carry its wish and pinned state

Both fields were made optional to avoid editing test files that were out of
scope at the time, but the API populates them on every planned day, so the
optionality described nothing real and quietly loosened the contract between
the wire format and the client — which is where this codebase has historically
gone wrong.

The inline objects that forced the compromise now go through the typed test
factory instead, so the next field added to a planned day is a one-line change
rather than another round of this.
This commit is contained in:
2026-09-17 18:33:30 +02:00
parent 6a7c0ef255
commit c368042c7e
4 changed files with 45 additions and 159 deletions
+6 -5
View File
@@ -13,6 +13,7 @@ import {
makePlannedDaysResult,
makeScraperFetchResult,
makeWorkspaceMembersResult,
makePlannedLeaveDay,
} from '../../tests/fixtures'
vi.mock('@/hooks')
@@ -88,8 +89,8 @@ describe('Dashboard', () => {
vi.mocked(hooks.usePlannedDays).mockReturnValue(
makePlannedDaysResult({
data: [
{ id: '1', workspaceId: 'ws-1', childId: 'c-1', parentPersonalDataUuid: 'pd-1', date: '2026-06-15', dayType: 'vacation', isDubbeldag: false, createdAt: '', updatedAt: '' },
{ id: '2', workspaceId: 'ws-1', childId: 'c-1', parentPersonalDataUuid: 'pd-1', date: '2026-06-16', dayType: 'sjukpenning', isDubbeldag: false, createdAt: '', updatedAt: '' },
makePlannedLeaveDay({ id: '1', date: '2026-06-15' }),
makePlannedLeaveDay({ id: '2', date: '2026-06-16', dayType: 'sjukpenning' }),
],
})
)
@@ -445,9 +446,9 @@ describe('Dashboard', () => {
vi.mocked(hooks.usePlannedDays).mockReturnValue(
makePlannedDaysResult({
data: [
{ id: '1', workspaceId: 'ws-1', childId: 'c-1', parentPersonalDataUuid: 'pd-1', date: '2026-06-15', dayType: 'vacation', isDubbeldag: false, createdAt: '', updatedAt: '' },
{ id: '2', workspaceId: 'ws-1', childId: 'c-1', parentPersonalDataUuid: 'pd-1', date: '2026-06-16', dayType: 'sjukpenning', isDubbeldag: false, createdAt: '', updatedAt: '' },
{ id: '3', workspaceId: 'ws-1', childId: 'c-1', parentPersonalDataUuid: 'pd-1', date: '2026-06-17', dayType: 'lagsta', isDubbeldag: false, createdAt: '', updatedAt: '' },
makePlannedLeaveDay({ id: '1', date: '2026-06-15' }),
makePlannedLeaveDay({ id: '2', date: '2026-06-16', dayType: 'sjukpenning' }),
makePlannedLeaveDay({ id: '3', date: '2026-06-17', dayType: 'lagsta' }),
],
})
)