mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-21 14:36:31 +00:00
test(tours): align assignment coverage with row action
This commit is contained in:
@@ -72,7 +72,7 @@ describe('CustomSelect consumer contracts', () => {
|
||||
expect(setDifficulty).toHaveBeenLastCalledWith(4)
|
||||
})
|
||||
|
||||
it('keeps the post-save day menu resolving numeric day ids', async () => {
|
||||
it('routes post-save assignment through the Tour-row menu and resolves numeric day ids', async () => {
|
||||
const user = userEvent.setup()
|
||||
const onAssignToDay = vi.fn().mockResolvedValue(undefined)
|
||||
render(<TranslationProvider><TourPlannerToursRail
|
||||
@@ -80,8 +80,13 @@ describe('CustomSelect consumer contracts', () => {
|
||||
planner={planner({ saveOutcome: tour, editingPlaceId: 42 })}
|
||||
tours={[tour]} days={days} loading={false} onAssignToDay={onAssignToDay} onViewGpxTour={vi.fn()}
|
||||
/></TranslationProvider>)
|
||||
await user.click(screen.getByRole('button', { name: 'Assign to a day' }))
|
||||
await user.click(screen.getByRole('button', { name: /Day 1/ }))
|
||||
const saveBanner = screen.getByText('Tour saved').closest('[role="status"]')!
|
||||
expect(within(saveBanner).getByRole('button', { name: 'Plan another' })).toBeInTheDocument()
|
||||
expect(within(saveBanner).queryByRole('button', { name: 'Assign to a day' })).not.toBeInTheDocument()
|
||||
await user.click(screen.getByRole('button', { name: 'Add to day: Ridge walk' }))
|
||||
const dayOption = screen.getByRole('button', { name: /Summit day/ })
|
||||
expect(dayOption).toHaveTextContent(/Day 1/)
|
||||
await user.click(dayOption)
|
||||
expect(onAssignToDay).toHaveBeenCalledWith(42, 7)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user