mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 23:46:35 +00:00
feat(assistant): booking and stay cards, and a read of the bookings with their details
This commit is contained in:
@@ -7,7 +7,7 @@ import { buildPlanner, buildShell } from '../../../helpers/mobileTrip'
|
||||
import { resetAllStores, seedStore } from '../../../helpers/store'
|
||||
import { fireEvent, render, screen } from '../../../helpers/render'
|
||||
|
||||
// FE-MOB-TRSH-001 to FE-MOB-TRSH-030
|
||||
// FE-MOB-TRSH-001 to FE-MOB-TRSH-033
|
||||
|
||||
vi.mock('../../../../src/utils/fileDownload', () => ({ openFile: vi.fn() }))
|
||||
|
||||
@@ -407,4 +407,39 @@ describe('MTransportSheet', () => {
|
||||
expect(planner.handleSelectDay).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('a booking the chat points at', () => {
|
||||
it('FE-MOB-TRSH-031: ?booking= of a transport opens its sheet once and leaves the URL', () => {
|
||||
const shell = makeShell({ sheet: null })
|
||||
render(<MTransportSheet planner={makePlanner()} shell={shell} />, { initialEntries: ['/trips/1?booking=7'] })
|
||||
expect(shell.openSheet).toHaveBeenCalledTimes(1)
|
||||
expect(shell.openSheet).toHaveBeenCalledWith('transport', { reservationId: 7 })
|
||||
})
|
||||
|
||||
it('FE-MOB-TRSH-032: a booking that is no transport, or an id the trip does not hold, opens nothing', () => {
|
||||
const dinner = { ...FLIGHT, id: 8, type: 'restaurant', endpoints: [] } as unknown as Reservation
|
||||
const shell = makeShell({ sheet: null })
|
||||
render(<MTransportSheet planner={makePlanner({ reservations: [FLIGHT, dinner] })} shell={shell} />, {
|
||||
initialEntries: ['/trips/1?booking=8'],
|
||||
})
|
||||
render(<MTransportSheet planner={makePlanner()} shell={shell} />, { initialEntries: ['/trips/1?booking=99'] })
|
||||
expect(shell.openSheet).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('FE-MOB-TRSH-033: with &map=1 the route is switched on and the map shown on its day, no sheet opened', () => {
|
||||
const days = [
|
||||
{ id: 3, trip_id: 1, day_number: 1, date: '2026-05-01' },
|
||||
{ id: 5, trip_id: 1, day_number: 3, date: '2026-05-03' },
|
||||
]
|
||||
const planner = makePlanner({ days, selectedDayId: 5 })
|
||||
const shell = makeShell({ sheet: null, trTab: 'transports', view: 'plan' })
|
||||
render(<MTransportSheet planner={planner} shell={shell} />, { initialEntries: ['/trips/1?booking=7&map=1'] })
|
||||
expect(shell.openSheet).not.toHaveBeenCalled()
|
||||
expect(planner.toggleConnection).toHaveBeenCalledTimes(1)
|
||||
expect(planner.toggleConnection).toHaveBeenCalledWith(7)
|
||||
expect(shell.setTrTab).toHaveBeenCalledWith('plan')
|
||||
expect(shell.toggleView).toHaveBeenCalledTimes(1)
|
||||
expect(planner.handleSelectDay).toHaveBeenCalledWith(3, false)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user