mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 17:41:51 +00:00
Merge dev into feat/tours and port Tours onto MikroORM
dev now runs on MikroORM, so the positional migrations, seeds.ts and DatabaseService the Tours server side was built on are gone. Behaviour is unchanged; persistence moves onto dev's architecture: - one MikroORM migration for tour_types, tours and tour_waypoints, idempotent so instances that ran the old positional steps keep their data; the hike tour type is seeded inside it, the addon row in the AddonSeeder - entities and repositories for the three tables, tours domain on repositories and UnitOfWork - tour facet joins in places, assignments and days re-applied on the repository code Fixes found while porting: - GPX import checks addon, trip access and permission in the handler instead of guards, so a refused upload gets a 403/404 instead of a connection reset - copying a trip copies its tours and waypoints - a tour cannot be moved onto a day that already has it - updateTour checks existence inside its transaction Adds tours e2e tests and rewrites the tours unit tests onto the migrated test database.
This commit is contained in:
@@ -290,8 +290,8 @@ describe('BackgroundTasksWidget: the mark on a finished job (#2477)', () => {
|
||||
const { baseElement } = render(<BackgroundTasksWidget />)
|
||||
|
||||
expect(screen.getByText('No reservations could be extracted from the uploaded files.')).toBeInTheDocument()
|
||||
expect(baseElement.querySelector('svg.lucide-alert-triangle')).toHaveAttribute('stroke', 'var(--warning)')
|
||||
expect(baseElement.querySelector('svg.lucide-check-circle2')).toBeNull()
|
||||
expect(baseElement.querySelector('svg.lucide-triangle-alert')).toHaveAttribute('stroke', 'var(--warning)')
|
||||
expect(baseElement.querySelector('svg.lucide-circle-check')).toBeNull()
|
||||
expect(baseElement.querySelector('.animate-spin')).toBeNull()
|
||||
})
|
||||
|
||||
@@ -300,8 +300,8 @@ describe('BackgroundTasksWidget: the mark on a finished job (#2477)', () => {
|
||||
const { baseElement } = render(<BackgroundTasksWidget />)
|
||||
|
||||
// The theme's own success colour, so it follows light and dark.
|
||||
expect(baseElement.querySelector('svg.lucide-check-circle2')).toHaveAttribute('stroke', 'var(--success)')
|
||||
expect(baseElement.querySelector('svg.lucide-alert-triangle')).toBeNull()
|
||||
expect(baseElement.querySelector('svg.lucide-circle-check')).toHaveAttribute('stroke', 'var(--success)')
|
||||
expect(baseElement.querySelector('svg.lucide-triangle-alert')).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -335,7 +335,7 @@ describe('PackingListPanel', () => {
|
||||
const { container } = render(<PackingListPanel tripId={1} items={[item1, item2]} />);
|
||||
|
||||
// Open the MoreHorizontal context menu
|
||||
const moreBtn = container.querySelector('svg.lucide-more-horizontal')?.closest('button');
|
||||
const moreBtn = container.querySelector('svg.lucide-ellipsis')?.closest('button');
|
||||
expect(moreBtn).toBeTruthy();
|
||||
await user.click(moreBtn!);
|
||||
|
||||
@@ -447,7 +447,7 @@ describe('PackingListPanel', () => {
|
||||
const { container } = render(<PackingListPanel tripId={1} items={[item1, item2]} />);
|
||||
|
||||
// Open the MoreHorizontal context menu
|
||||
const moreBtn = container.querySelector('svg.lucide-more-horizontal')?.closest('button');
|
||||
const moreBtn = container.querySelector('svg.lucide-ellipsis')?.closest('button');
|
||||
expect(moreBtn).toBeTruthy();
|
||||
await user.click(moreBtn!);
|
||||
|
||||
@@ -529,7 +529,7 @@ describe('PackingListPanel', () => {
|
||||
const { container } = render(<PackingListPanel tripId={1} items={[item]} />);
|
||||
|
||||
// Open the category context menu
|
||||
const moreBtn = container.querySelector('svg.lucide-more-horizontal')?.closest('button');
|
||||
const moreBtn = container.querySelector('svg.lucide-ellipsis')?.closest('button');
|
||||
expect(moreBtn).toBeTruthy();
|
||||
await user.click(moreBtn!);
|
||||
|
||||
@@ -1046,7 +1046,7 @@ describe('PackingListPanel', () => {
|
||||
const { container } = render(<PackingListPanel tripId={1} items={[item1, item2]} />);
|
||||
|
||||
// Open context menu and click Delete List
|
||||
const moreBtn = container.querySelector('svg.lucide-more-horizontal')?.closest('button');
|
||||
const moreBtn = container.querySelector('svg.lucide-ellipsis')?.closest('button');
|
||||
await user.click(moreBtn!);
|
||||
await user.click(await screen.findByText('Delete List'));
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ function setup(overrides: Partial<Props> = {}) {
|
||||
|
||||
/** The category header owns the first MoreHorizontal; item rows render their own. */
|
||||
function openCategoryMenu(container: HTMLElement) {
|
||||
const btn = container.querySelectorAll('svg.lucide-more-horizontal')[0].closest('button')!
|
||||
const btn = container.querySelectorAll('svg.lucide-ellipsis')[0].closest('button')!
|
||||
fireEvent.click(btn)
|
||||
return btn
|
||||
}
|
||||
@@ -303,7 +303,7 @@ describe('KategorieGruppe — bulk actions', () => {
|
||||
|
||||
it('FE-W5CAT-015a: the menu trigger highlights on hover', () => {
|
||||
const { container } = setup()
|
||||
const trigger = container.querySelectorAll('svg.lucide-more-horizontal')[0].closest('button')!
|
||||
const trigger = container.querySelectorAll('svg.lucide-ellipsis')[0].closest('button')!
|
||||
|
||||
fireEvent.mouseEnter(trigger)
|
||||
expect(trigger.style.color).toBe('var(--text-secondary)')
|
||||
|
||||
@@ -2634,7 +2634,7 @@ describe('DayPlanSidebar', () => {
|
||||
// ferry from IJmuiden to the Port of Tyne in the evening. The slot written here is the
|
||||
// one every other reader takes from then on, the road trip included.
|
||||
const crossing = (newcastleAt: string | null, withAmsterdam = true) => {
|
||||
const day = buildDay({ id: 10, date: '2026-10-06', title: 'Day 2' })
|
||||
const day = buildDay({ id: 10, date: '2025-10-06', title: 'Day 2' })
|
||||
const amsterdam = buildPlace({ id: 1, name: 'Amsterdam', lat: 52.3731, lng: 4.8926 })
|
||||
const newcastle = buildPlace({ id: 2, name: 'Newcastle', lat: 54.9783, lng: -1.6178, place_time: newcastleAt })
|
||||
const stops = [
|
||||
@@ -2643,7 +2643,7 @@ describe('DayPlanSidebar', () => {
|
||||
].filter(a => withAmsterdam || a.id !== 11)
|
||||
const ferry = buildReservation({
|
||||
id: 69, type: 'ferry', title: 'IJmuiden to Newcastle', day_id: 10,
|
||||
reservation_time: '2026-10-06T17:30', reservation_end_time: '2026-10-06T23:00',
|
||||
reservation_time: '2025-10-06T17:30', reservation_end_time: '2025-10-06T23:00',
|
||||
endpoints: [
|
||||
{ role: 'from', sequence: 0, name: 'IJmuiden', code: null, lat: 52.4581, lng: 4.5879, timezone: null, local_date: null, local_time: null },
|
||||
{ role: 'to', sequence: 1, name: 'Port of Tyne', code: null, lat: 54.9925, lng: -1.4522, timezone: null, local_date: null, local_time: null },
|
||||
@@ -2684,12 +2684,12 @@ describe('DayPlanSidebar', () => {
|
||||
// Worked out over Amsterdam alone, the clock closed the day at 1.5: behind the hotel
|
||||
// for the road trip, which then drove to Newcastle overland before the crossing.
|
||||
const { reservationsApi } = await import('../../api/client')
|
||||
const day = buildDay({ id: 10, date: '2026-10-06', title: 'Day 2' })
|
||||
const day = buildDay({ id: 10, date: '2025-10-06', title: 'Day 2' })
|
||||
const amsterdam = buildPlace({ id: 1, name: 'Amsterdam', lat: 52.3731, lng: 4.8926 })
|
||||
const hotel = buildPlace({ id: 3, name: 'Hotel Newcastle', lat: 54.975, lng: -1.61 })
|
||||
const ferry = buildReservation({
|
||||
id: 69, type: 'ferry', title: 'IJmuiden to Newcastle', day_id: 10,
|
||||
reservation_time: '2026-10-06T17:30', reservation_end_time: '2026-10-06T23:00',
|
||||
reservation_time: '2025-10-06T17:30', reservation_end_time: '2025-10-06T23:00',
|
||||
endpoints: [
|
||||
{ role: 'from', sequence: 0, name: 'IJmuiden', code: null, lat: 52.4581, lng: 4.5879, timezone: null, local_date: null, local_time: null },
|
||||
{ role: 'to', sequence: 1, name: 'Port of Tyne', code: null, lat: 54.9925, lng: -1.4522, timezone: null, local_date: null, local_time: null },
|
||||
@@ -4134,9 +4134,9 @@ describe('DayPlanSidebar', () => {
|
||||
// Day 2 checks out of a Munich hotel and into a Hamburg one, and nothing else is
|
||||
// planned on it. The booked night's own stop never reaches the list.
|
||||
const movingDays = [
|
||||
buildDay({ id: 10, date: '2026-11-03', title: 'Day 1' }),
|
||||
buildDay({ id: 11, date: '2026-11-04', title: 'Day 2' }),
|
||||
buildDay({ id: 12, date: '2026-11-05', title: 'Day 3' }),
|
||||
buildDay({ id: 10, date: '2025-11-03', title: 'Day 1' }),
|
||||
buildDay({ id: 11, date: '2025-11-04', title: 'Day 2' }),
|
||||
buildDay({ id: 12, date: '2025-11-05', title: 'Day 3' }),
|
||||
]
|
||||
const stays: Accommodation[] = [
|
||||
{ id: 1, trip_id: 1, start_day_id: 10, end_day_id: 11, place_lat: 48.137, place_lng: 11.575, place_name: 'Hotel A' },
|
||||
@@ -4146,7 +4146,7 @@ describe('DayPlanSidebar', () => {
|
||||
({ role, sequence: role === 'from' ? 0 : 1, name, code: null, lat, lng, timezone: null, local_date: null, local_time: null })
|
||||
const flight = (located: boolean) => buildReservation({
|
||||
id: 77, type: 'flight', title: 'LH 2078', day_id: 11, end_day_id: 11,
|
||||
reservation_time: '2026-11-04T15:15:00', reservation_end_time: '2026-11-04T17:20:00',
|
||||
reservation_time: '2025-11-04T15:15:00', reservation_end_time: '2025-11-04T17:20:00',
|
||||
endpoints: located ? [airport('from', 'MUC', 48.353, 11.786), airport('to', 'HAM', 53.63, 9.988)] : [],
|
||||
})
|
||||
|
||||
@@ -4184,7 +4184,7 @@ describe('DayPlanSidebar', () => {
|
||||
const user = userEvent.setup()
|
||||
const { generateGoogleMapsUrl } = await import('../Map/RouteCalculator')
|
||||
const openSpy = vi.spyOn(window, 'open').mockReturnValue(null)
|
||||
const day = buildDay({ id: 10, date: '2026-11-03', title: 'Day 1' })
|
||||
const day = buildDay({ id: 10, date: '2025-11-03', title: 'Day 1' })
|
||||
const assignments = {
|
||||
'10': [
|
||||
buildAssignment({ id: 1, day_id: 10, order_index: 0, place: buildPlace({ id: 1, name: 'Elbphilharmonie', lat: 53.541, lng: 9.984 }) }),
|
||||
|
||||
Reference in New Issue
Block a user