Cover the mappers and labels nothing was watching
The day-override mapper was the only one in the client with no test feeding it the shape the server actually sends, which is how a feature once shipped rendering blank cards to everyone while the suite stayed green. The apply response's collision fields were mapped but only ever exercised with an empty list, and the leave band's accessible label, composed from translated text and two dates, was asserted nowhere. All three were correct; none was guarded. The day-override hook's fixtures now go through the typed factory rather than hand-written objects.
This commit is contained in:
@@ -266,6 +266,27 @@ describe('CalendarWeek', () => {
|
||||
render(<CalendarWeek {...defaultProps} plannedDays={[]} />)
|
||||
expect(screen.queryByTestId('calendar-event')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('composes the band aria-label from parent label, type label, and the interpolated date range', () => {
|
||||
// Regression guard: a tips bug in this repo surfaced as the literal
|
||||
// un-interpolated "Tip: {title}" in an accessibility label and nothing
|
||||
// caught it. Assert the real composed string here, not merely that an
|
||||
// aria-label attribute exists.
|
||||
const plannedDays = [
|
||||
pd({ id: '1', date: '2026-01-05', dayType: 'sjukpenning' }),
|
||||
pd({ id: '2', date: '2026-01-06', dayType: 'sjukpenning' }),
|
||||
]
|
||||
render(<CalendarWeek {...defaultProps} plannedDays={plannedDays} parentName="Alice" />)
|
||||
const band = screen.getAllByTestId(/^calendar-band-/)[0]
|
||||
expect(band).toHaveAttribute('aria-label', 'Alice · Sjukpenning, 2026-01-05 – 2026-01-06')
|
||||
})
|
||||
|
||||
it('uses the partner label in the band aria-label for the other parent\'s days', () => {
|
||||
const plannedDays = [pd({ id: '1', date: '2026-01-05', parentPersonalDataUuid: 'other-parent' })]
|
||||
render(<CalendarWeek {...defaultProps} plannedDays={plannedDays} personalDataUuid="parent-1" />)
|
||||
const band = screen.getAllByTestId(/^calendar-band-/)[0]
|
||||
expect(band).toHaveAttribute('aria-label', 'Partner · Semester, 2026-01-05 – 2026-01-05')
|
||||
})
|
||||
})
|
||||
|
||||
describe('the weekend-gap bug: a wish-linked band bridges free-day gaps', () => {
|
||||
|
||||
Reference in New Issue
Block a user