The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
test(db): run the packing, reservations and journey suites on the real database module
Mauricec51f4f78bbdd
diff --git a/server/scripts/test-mocks-baseline.json b/server/scripts/test-mocks-baseline.jsonindex 56aa1d5f3..844eb302f 100644--- a/server/scripts/test-mocks-baseline.json+++ b/server/scripts/test-mocks-baseline.json@@ -53,7 +53,6 @@"tests/e2e/vacay.e2e.test.ts": 1,"tests/e2e/weather.e2e.test.ts": 1,"tests/integration/dayReorder.test.ts": 1,- "tests/integration/journey.test.ts": 1,"tests/integration/leg-mode-incoming.test.ts": 1,"tests/integration/legacy-upgrade-v066.test.ts": 1,"tests/integration/legacy-upgrade-v082.test.ts": 1,@@ -66,11 +65,9 @@"tests/integration/memories-unified.test.ts": 1,"tests/integration/oauth-authorize.test.ts": 1,"tests/integration/oauth.test.ts": 1,- "tests/integration/packing.test.ts": 1,"tests/integration/places.test.ts": 1,"tests/integration/plugins/boot-registry-order.test.ts": 1,"tests/integration/plugins/plugin-runtime.test.ts": 1,- "tests/integration/reservations.test.ts": 1,"tests/integration/scheduler-gate.test.ts": 1,"tests/integration/security.test.ts": 1,"tests/integration/settings.test.ts": 1,diff --git a/server/tests/integration/journey.test.ts b/server/tests/integration/journey.test.tsindex 048cbaebe..7e0561a78 100644--- a/server/tests/integration/journey.test.ts+++ b/server/tests/integration/journey.test.ts@@ -3,23 +3,18 @@* Covers JOURNEY-INT-001 through JOURNEY-INT-020.*/import { buildApp } from '../../src/bootstrap';-import { db as testDb } from '../../src/db/database';import { Addons } from '../../src/db/entities/Addons.entity';import { TrekPhotos } from '../../src/db/entities/TrekPhotos.entity';import { invalidatePermissionsCache } from '../../src/nest/permissions/permissions-cache';import { authCookie } from '../helpers/auth';import { jpegWithExif } from '../helpers/exif-jpeg';-import {- createUser,- createAdmin,- createTrip,- createJourney,- createJourneyEntry,- addJourneyContributor,-} from '../helpers/factories';+import { addJourneyContributor, makeJourney, makeJourneyEntry } from '../helpers/factories/journeys';import { findRow, upsertRow } from '../helpers/factories/rows';import { setAppSetting } from '../helpers/factories/settings';-import { resetTestDb, resetRateLimits } from '../helpers/test-db';+import { makeTrip } from '../helpers/factories/trips';+import { makeUser } from '../helpers/factories/users';+import { resetDatabase } from '../helpers/reset-database';+import { resetRateLimits } from '../helpers/test-db';import { MikroORM } from '@mikro-orm/core';import type { INestApplication } from '@nestjs/common';@@ -30,10 +25,6 @@ import { describe, it, expect, vi, beforeAll, beforeEach, afterAll, afterEach }// ─────────────────────────────────────────────────────────────────────────────// Step 1: Bare in-memory DB — schema applied in beforeAll after mocks register// ─────────────────────────────────────────────────────────────────────────────-vi.mock('../../src/db/database', async () => {- const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');- return buildDbMock(createSnapshotTestDb());-});let nestApp: INestApplication;let app: Application;@@ -45,7 +36,7 @@ beforeAll(async () => {orm = nestApp.get(MikroORM);});beforeEach(async () => {- resetTestDb(testDb);+ await resetDatabase(orm);await resetRateLimits(nestApp);await invalidatePermissionsCache();// Enable the journey addon@@ -61,7 +52,6 @@ beforeEach(async () => {});afterAll(async () => {await nestApp.close();- testDb.close();});// ─────────────────────────────────────────────────────────────────────────────@@ -70,7 +60,7 @@ afterAll(async () => {describe('List journeys', () => {it('JOURNEY-INT-001 — GET /api/journeys returns 200 with empty list initially', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).get('/api/journeys').set('Cookie', authCookie(user.id));@@ -90,7 +80,7 @@ describe('List journeys', () => {describe('Create journey', () => {it('JOURNEY-INT-003 — POST /api/journeys creates a journey', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).post('/api/journeys')@@ -115,8 +105,8 @@ describe('Create journey', () => {describe('Get journey detail', () => {it('JOURNEY-INT-004 — GET /api/journeys/:id returns full detail', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id, { title: 'Iceland' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id, { title: 'Iceland' });const res = await request(app).get(`/api/journeys/${journey.id}`).set('Cookie', authCookie(user.id));@@ -128,7 +118,7 @@ describe('Get journey detail', () => {});it('JOURNEY-INT-005 — GET /api/journeys/:id returns 404 for non-existent', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).get('/api/journeys/99999').set('Cookie', authCookie(user.id));@@ -142,8 +132,8 @@ describe('Get journey detail', () => {describe('Update journey', () => {it('JOURNEY-INT-006 — PATCH /api/journeys/:id updates journey', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id, { title: 'Draft' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id, { title: 'Draft' });const res = await request(app).patch(`/api/journeys/${journey.id}`)@@ -162,8 +152,8 @@ describe('Update journey', () => {describe('Delete journey', () => {it('JOURNEY-INT-007 — DELETE /api/journeys/:id deletes journey', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).delete(`/api/journeys/${journey.id}`).set('Cookie', authCookie(user.id));@@ -182,9 +172,9 @@ describe('Delete journey', () => {describe('Journey trips', () => {it('JOURNEY-INT-008 — POST /api/journeys/:id/trips links a trip', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const trip = createTrip(testDb, user.id, { title: 'Paris', start_date: '2026-06-01', end_date: '2026-06-05' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const trip = await makeTrip(orm, user.id, { title: 'Paris', start_date: '2026-06-01', end_date: '2026-06-05' });const res = await request(app).post(`/api/journeys/${journey.id}/trips`)@@ -201,9 +191,9 @@ describe('Journey trips', () => {});it('JOURNEY-INT-009 — DELETE /api/journeys/:id/trips/:tripId unlinks trip', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const trip = createTrip(testDb, user.id, { title: 'Rome', start_date: '2026-07-01', end_date: '2026-07-03' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const trip = await makeTrip(orm, user.id, { title: 'Rome', start_date: '2026-07-01', end_date: '2026-07-03' });// Link via API first (avoids factory column mismatch)await request(app)@@ -226,8 +216,8 @@ describe('Journey trips', () => {describe('Journey entries', () => {it('JOURNEY-INT-010 — POST /api/journeys/:id/entries creates an entry', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).post(`/api/journeys/${journey.id}/entries`).set('Cookie', authCookie(user.id)).send({title: 'First day in Tokyo',@@ -244,9 +234,9 @@ describe('Journey entries', () => {});it('JOURNEY-INT-011 — PATCH /api/journeys/entries/:id updates entry', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, {+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, {title: 'Original',entry_date: '2026-04-01',});@@ -262,8 +252,8 @@ describe('Journey entries', () => {});it('JOURNEY-INT-010b — a timed entry goes where its time puts it in the day, an untimed one last (#2679)', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const post = (title: string, entry_time?: string) =>request(app).post(`/api/journeys/${journey.id}/entries`)@@ -281,8 +271,8 @@ describe('Journey entries', () => {});it('JOURNEY-INT-011b — a new time moves the entry, an unchanged one keeps a hand-made order (#2679)', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const post = async (title: string, entry_time: string) =>(await request(app)@@ -315,9 +305,9 @@ describe('Journey entries', () => {});it('JOURNEY-INT-012 — DELETE /api/journeys/entries/:id deletes entry', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, {+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, {title: 'To delete',entry_date: '2026-04-02',});@@ -335,9 +325,9 @@ describe('Journey entries', () => {describe('Journey contributors', () => {it('JOURNEY-INT-013 — POST /api/journeys/:id/contributors adds a contributor', async () => {- const { user: owner } = createUser(testDb);- const { user: contributor } = createUser(testDb);- const journey = createJourney(testDb, owner.id);+ const { user: owner } = await makeUser(orm);+ const { user: contributor } = await makeUser(orm);+ const journey = await makeJourney(orm, owner.id);const res = await request(app).post(`/api/journeys/${journey.id}/contributors`)@@ -354,10 +344,10 @@ describe('Journey contributors', () => {});it('JOURNEY-INT-014 — DELETE /api/journeys/:id/contributors/:userId removes contributor', async () => {- const { user: owner } = createUser(testDb);- const { user: contributor } = createUser(testDb);- const journey = createJourney(testDb, owner.id);- addJourneyContributor(testDb, journey.id, contributor.id, 'editor');+ const { user: owner } = await makeUser(orm);+ const { user: contributor } = await makeUser(orm);+ const journey = await makeJourney(orm, owner.id);+ await addJourneyContributor(orm, journey.id, contributor.id, 'editor');const res = await request(app).delete(`/api/journeys/${journey.id}/contributors/${contributor.id}`)@@ -378,8 +368,8 @@ describe('Journey contributors', () => {describe('Journey share link', () => {it('JOURNEY-INT-015 — GET /api/journeys/:id/share-link returns null initially', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).get(`/api/journeys/${journey.id}/share-link`).set('Cookie', authCookie(user.id));@@ -388,8 +378,8 @@ describe('Journey share link', () => {});it('JOURNEY-INT-016 — POST /api/journeys/:id/share-link creates a share link', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).post(`/api/journeys/${journey.id}/share-link`)@@ -411,10 +401,10 @@ describe('Journey share link', () => {});it('JOURNEY-INT-044 — a contributor cannot read the token, only the owner can', async () => {- const { user: owner } = createUser(testDb);- const { user: helper } = createUser(testDb);- const journey = createJourney(testDb, owner.id);- addJourneyContributor(testDb, journey.id, helper.id, 'editor');+ const { user: owner } = await makeUser(orm);+ const { user: helper } = await makeUser(orm);+ const journey = await makeJourney(orm, owner.id);+ await addJourneyContributor(orm, journey.id, helper.id, 'editor');await request(app).post(`/api/journeys/${journey.id}/share-link`).set('Cookie', authCookie(owner.id))@@ -436,8 +426,8 @@ describe('Journey share link', () => {});it('JOURNEY-INT-044b — an owner with nothing published still gets 200 and a null link', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).get(`/api/journeys/${journey.id}/share-link`).set('Cookie', authCookie(user.id));@@ -446,8 +436,8 @@ describe('Journey share link', () => {});it('JOURNEY-INT-045 — a flag-only update leaves the other flags alone', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);await request(app).post(`/api/journeys/${journey.id}/share-link`).set('Cookie', authCookie(user.id))@@ -466,8 +456,8 @@ describe('Journey share link', () => {});it('JOURNEY-INT-017 — DELETE /api/journeys/:id/share-link deletes the share link', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);// Create firstawait request(app)@@ -493,11 +483,11 @@ describe('Journey share link', () => {describe('Journey permissions', () => {it('JOURNEY-INT-018 — contributor (viewer) can read but non-member cannot', async () => {- const { user: owner } = createUser(testDb);- const { user: viewer } = createUser(testDb);- const { user: outsider } = createUser(testDb);- const journey = createJourney(testDb, owner.id, { title: 'Private Journey' });- addJourneyContributor(testDb, journey.id, viewer.id, 'viewer');+ const { user: owner } = await makeUser(orm);+ const { user: viewer } = await makeUser(orm);+ const { user: outsider } = await makeUser(orm);+ const journey = await makeJourney(orm, owner.id, { title: 'Private Journey' });+ await addJourneyContributor(orm, journey.id, viewer.id, 'viewer');// Viewer can readconst viewerRes = await request(app).get(`/api/journeys/${journey.id}`).set('Cookie', authCookie(viewer.id));@@ -510,10 +500,10 @@ describe('Journey permissions', () => {});it('JOURNEY-INT-019 — non-owner cannot delete a journey', async () => {- const { user: owner } = createUser(testDb);- const { user: editor } = createUser(testDb);- const journey = createJourney(testDb, owner.id);- addJourneyContributor(testDb, journey.id, editor.id, 'editor');+ const { user: owner } = await makeUser(orm);+ const { user: editor } = await makeUser(orm);+ const journey = await makeJourney(orm, owner.id);+ await addJourneyContributor(orm, journey.id, editor.id, 'editor');// Editor can readconst readRes = await request(app).get(`/api/journeys/${journey.id}`).set('Cookie', authCookie(editor.id));@@ -535,10 +525,10 @@ describe('Journey permissions', () => {describe('Journey suggestions', () => {it('JOURNEY-INT-020 — GET /api/journeys/suggestions returns trip suggestions', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);// Create a recent trip so it shows up in suggestions- createTrip(testDb, user.id, {+ await makeTrip(orm, user.id, {title: 'Recent Trip',start_date: '2026-03-01',end_date: '2026-03-05',@@ -558,8 +548,8 @@ describe('Journey suggestions', () => {describe('Available trips', () => {it('JOURNEY-INT-021 — GET /api/journeys/available-trips returns user trips', async () => {- const { user } = createUser(testDb);- createTrip(testDb, user.id, { title: 'My Trip', start_date: '2026-05-01', end_date: '2026-05-03' });+ const { user } = await makeUser(orm);+ await makeTrip(orm, user.id, { title: 'My Trip', start_date: '2026-05-01', end_date: '2026-05-03' });const res = await request(app).get('/api/journeys/available-trips').set('Cookie', authCookie(user.id));@@ -577,7 +567,7 @@ describe('Available trips', () => {describe('Create journey validation', () => {it('JOURNEY-INT-022 — POST /api/journeys returns 400 without title', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).post('/api/journeys')@@ -589,7 +579,7 @@ describe('Create journey validation', () => {});it('JOURNEY-INT-023 — POST /api/journeys returns 400 for blank title', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).post('/api/journeys').set('Cookie', authCookie(user.id)).send({ title: ' ' });@@ -604,9 +594,9 @@ describe('Create journey validation', () => {describe('Provider photos', () => {it('JOURNEY-INT-024 — POST /api/journeys/entries/:id/provider-photos creates provider photo', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-04-01' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-04-01' });const res = await request(app).post(`/api/journeys/entries/${entry.id}/provider-photos`)@@ -620,9 +610,9 @@ describe('Provider photos', () => {});it('JOURNEY-INT-025 — POST /api/journeys/entries/:id/provider-photos returns 400 without required fields', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-04-01' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-04-01' });const res = await request(app).post(`/api/journeys/entries/${entry.id}/provider-photos`)@@ -634,11 +624,11 @@ describe('Provider photos', () => {});it('JOURNEY-INT-026 — POST /api/journeys/entries/:id/provider-photos returns 403 for viewer', async () => {- const { user: owner } = createUser(testDb);- const { user: viewer } = createUser(testDb);- const journey = createJourney(testDb, owner.id);- addJourneyContributor(testDb, journey.id, viewer.id, 'viewer');- const entry = createJourneyEntry(testDb, journey.id, owner.id, { entry_date: '2026-04-01' });+ const { user: owner } = await makeUser(orm);+ const { user: viewer } = await makeUser(orm);+ const journey = await makeJourney(orm, owner.id);+ await addJourneyContributor(orm, journey.id, viewer.id, 'viewer');+ const entry = await makeJourneyEntry(orm, journey.id, owner.id, { entry_date: '2026-04-01' });const res = await request(app).post(`/api/journeys/entries/${entry.id}/provider-photos`)@@ -655,10 +645,10 @@ describe('Provider photos', () => {describe('Link photo to entry', () => {it('JOURNEY-INT-027 — POST /api/journeys/entries/:id/link-photo moves photo', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry1 = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-04-01' });- const entry2 = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-04-02' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry1 = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-04-01' });+ const entry2 = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-04-02' });// Add a provider photo to entry1const photoRes = await request(app)@@ -677,9 +667,9 @@ describe('Link photo to entry', () => {});it('JOURNEY-INT-028 — POST /api/journeys/entries/:id/link-photo returns 400 without photo_id', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-04-01' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-04-01' });const res = await request(app).post(`/api/journeys/entries/${entry.id}/link-photo`)@@ -697,9 +687,9 @@ describe('Link photo to entry', () => {describe('Update photo', () => {it('JOURNEY-INT-029 — PATCH /api/journeys/photos/:id updates caption and sort_order', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-04-01' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-04-01' });// Add a provider photo firstconst photoRes = await request(app)@@ -718,7 +708,7 @@ describe('Update photo', () => {});it('JOURNEY-INT-030 — PATCH /api/journeys/photos/:id returns 404 for non-existent photo', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).patch('/api/journeys/photos/99999')@@ -735,9 +725,9 @@ describe('Update photo', () => {describe('Delete photo (route)', () => {it('JOURNEY-INT-031 — DELETE /api/journeys/photos/:id deletes photo', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-04-01' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-04-01' });const photoRes = await request(app).post(`/api/journeys/entries/${entry.id}/provider-photos`)@@ -753,7 +743,7 @@ describe('Delete photo (route)', () => {});it('JOURNEY-INT-032 — DELETE /api/journeys/photos/:id returns 404 for non-existent', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).delete('/api/journeys/photos/99999').set('Cookie', authCookie(user.id));@@ -767,10 +757,10 @@ describe('Delete photo (route)', () => {describe('Journey entries sub-routes', () => {it('JOURNEY-INT-033 — GET /api/journeys/:id/entries returns entries list', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- createJourneyEntry(testDb, journey.id, user.id, { title: 'Day 1', entry_date: '2026-04-01' });- createJourneyEntry(testDb, journey.id, user.id, { title: 'Day 2', entry_date: '2026-04-02' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ await makeJourneyEntry(orm, journey.id, user.id, { title: 'Day 1', entry_date: '2026-04-01' });+ await makeJourneyEntry(orm, journey.id, user.id, { title: 'Day 2', entry_date: '2026-04-02' });const res = await request(app).get(`/api/journeys/${journey.id}/entries`).set('Cookie', authCookie(user.id));@@ -779,9 +769,9 @@ describe('Journey entries sub-routes', () => {});it('JOURNEY-INT-034 — GET /api/journeys/:id/entries returns 404 for inaccessible journey', async () => {- const { user: owner } = createUser(testDb);- const { user: outsider } = createUser(testDb);- const journey = createJourney(testDb, owner.id);+ const { user: owner } = await makeUser(orm);+ const { user: outsider } = await makeUser(orm);+ const journey = await makeJourney(orm, owner.id);const res = await request(app).get(`/api/journeys/${journey.id}/entries`).set('Cookie', authCookie(outsider.id));@@ -789,8 +779,8 @@ describe('Journey entries sub-routes', () => {});it('JOURNEY-INT-035 — POST /api/journeys/:id/entries returns 400 without entry_date', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).post(`/api/journeys/${journey.id}/entries`)@@ -808,7 +798,7 @@ describe('Journey entries sub-routes', () => {describe('Update entry edge cases', () => {it('JOURNEY-INT-036 — PATCH /api/journeys/entries/:id returns 404 for non-existent entry', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).patch('/api/journeys/entries/99999')@@ -819,7 +809,7 @@ describe('Update entry edge cases', () => {});it('JOURNEY-INT-037 — DELETE /api/journeys/entries/:id returns 404 for non-existent entry', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).delete('/api/journeys/entries/99999').set('Cookie', authCookie(user.id));@@ -833,8 +823,8 @@ describe('Update entry edge cases', () => {describe('Trip link validation', () => {it('JOURNEY-INT-038 — POST /api/journeys/:id/trips returns 400 without trip_id', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).post(`/api/journeys/${journey.id}/trips`)@@ -846,11 +836,15 @@ describe('Trip link validation', () => {});it('JOURNEY-INT-039 — DELETE /api/journeys/:id/trips/:tripId returns 403 for non-owner', async () => {- const { user: owner } = createUser(testDb);- const { user: editor } = createUser(testDb);- const journey = createJourney(testDb, owner.id);- addJourneyContributor(testDb, journey.id, editor.id, 'editor');- const trip = createTrip(testDb, owner.id, { title: 'Link Trip', start_date: '2026-06-01', end_date: '2026-06-03' });+ const { user: owner } = await makeUser(orm);+ const { user: editor } = await makeUser(orm);+ const journey = await makeJourney(orm, owner.id);+ await addJourneyContributor(orm, journey.id, editor.id, 'editor');+ const trip = await makeTrip(orm, owner.id, {+ title: 'Link Trip',+ start_date: '2026-06-01',+ end_date: '2026-06-03',+ });await request(app).post(`/api/journeys/${journey.id}/trips`)@@ -871,8 +865,8 @@ describe('Trip link validation', () => {describe('Contributor route validation', () => {it('JOURNEY-INT-040 — POST /api/journeys/:id/contributors returns 400 without user_id', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).post(`/api/journeys/${journey.id}/contributors`)@@ -884,10 +878,10 @@ describe('Contributor route validation', () => {});it('JOURNEY-INT-041 — PATCH /api/journeys/:id/contributors/:userId updates role', async () => {- const { user: owner } = createUser(testDb);- const { user: contrib } = createUser(testDb);- const journey = createJourney(testDb, owner.id);- addJourneyContributor(testDb, journey.id, contrib.id, 'viewer');+ const { user: owner } = await makeUser(orm);+ const { user: contrib } = await makeUser(orm);+ const journey = await makeJourney(orm, owner.id);+ await addJourneyContributor(orm, journey.id, contrib.id, 'viewer');const res = await request(app).patch(`/api/journeys/${journey.id}/contributors/${contrib.id}`)@@ -899,12 +893,12 @@ describe('Contributor route validation', () => {});it('JOURNEY-INT-042 — PATCH /api/journeys/:id/contributors/:userId returns 403 for non-owner', async () => {- const { user: owner } = createUser(testDb);- const { user: editor } = createUser(testDb);- const { user: target } = createUser(testDb);- const journey = createJourney(testDb, owner.id);- addJourneyContributor(testDb, journey.id, editor.id, 'editor');- addJourneyContributor(testDb, journey.id, target.id, 'viewer');+ const { user: owner } = await makeUser(orm);+ const { user: editor } = await makeUser(orm);+ const { user: target } = await makeUser(orm);+ const journey = await makeJourney(orm, owner.id);+ await addJourneyContributor(orm, journey.id, editor.id, 'editor');+ await addJourneyContributor(orm, journey.id, target.id, 'viewer');const res = await request(app).patch(`/api/journeys/${journey.id}/contributors/${target.id}`)@@ -921,8 +915,8 @@ describe('Contributor route validation', () => {describe('Share link update', () => {it('JOURNEY-INT-043 — POST /api/journeys/:id/share-link updates existing share link permissions', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);// Create initial share linkconst create = await request(app)@@ -950,8 +944,8 @@ describe('Share link update', () => {});it('JOURNEY-INT-044 — journey PATCH /:id can update status', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).patch(`/api/journeys/${journey.id}`)@@ -970,9 +964,9 @@ describe('Share link update', () => {describe('Provider photos — passphrase persistence', () => {it('JOURNEY-INT-046 — single mode with passphrase persists encrypted passphrase on trek_photos', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-04-01' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-04-01' });const res = await request(app).post(`/api/journeys/entries/${entry.id}/provider-photos`)@@ -991,9 +985,9 @@ describe('Provider photos — passphrase persistence', () => {});it('JOURNEY-INT-047 — batch mode with passphrase persists encrypted passphrase on all trek_photos rows', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-04-02' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-04-02' });const res = await request(app).post(`/api/journeys/entries/${entry.id}/provider-photos`)@@ -1015,9 +1009,9 @@ describe('Provider photos — passphrase persistence', () => {describe('Photo upload validation', () => {it('JOURNEY-INT-045 — POST /api/journeys/entries/:id/photos returns 400 without files', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-04-01' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-04-01' });const res = await request(app).post(`/api/journeys/entries/${entry.id}/photos`).set('Cookie', authCookie(user.id));@@ -1042,9 +1036,9 @@ describe('Journey upload parity', () => {});it('JOURNEY-P01 — entry photo upload stores journey/<uuid> with a lowercased extension', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-04-01' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-04-01' });const res = await request(app).post(`/api/journeys/entries/${entry.id}/photos`)@@ -1058,9 +1052,9 @@ describe('Journey upload parity', () => {});it('JOURNEY-P02 — extensionless originalname falls back to .jpg (wildcard allowlist)', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-04-01' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-04-01' });// The admin allowlist rejects the empty extension before the filename// fallback can run; the wildcard makes the fallback reachable so it is// actually pinned here.@@ -1075,9 +1069,9 @@ describe('Journey upload parity', () => {});it('JOURNEY-P03 — non-image entry upload is rejected 400', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-04-01' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-04-01' });const res = await request(app).post(`/api/journeys/entries/${entry.id}/photos`)@@ -1088,8 +1082,8 @@ describe('Journey upload parity', () => {});it('JOURNEY-P04 — gallery photo upload stores journey/<uuid> paths', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).post(`/api/journeys/${journey.id}/gallery/photos`)@@ -1100,9 +1094,9 @@ describe('Journey upload parity', () => {});it('JOURNEY-P05 — non-contributor gallery upload is 403 and the bytes are taken back off disk', async () => {- const { user: owner } = createUser(testDb);- const { user: other } = createUser(testDb);- const journey = createJourney(testDb, owner.id);+ const { user: owner } = await makeUser(orm);+ const { user: other } = await makeUser(orm);+ const journey = await makeJourney(orm, owner.id);const before = fsMod.existsSync(journeyDir) ? fsMod.readdirSync(journeyDir).length : 0;const res = await request(app)@@ -1118,8 +1112,8 @@ describe('Journey upload parity', () => {});it('JOURNEY-P06 — video+poster upload: poster is ALWAYS stored as .jpg (stored-XSS pin)', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).post(`/api/journeys/${journey.id}/gallery/video`)@@ -1133,8 +1127,8 @@ describe('Journey upload parity', () => {});it('JOURNEY-P07 — poster-only video upload is 400 with no files left anywhere', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const before = fsMod.existsSync(journeyDir) ? fsMod.readdirSync(journeyDir).length : 0;const res = await request(app)@@ -1148,9 +1142,9 @@ describe('Journey upload parity', () => {});it('JOURNEY-P08 — non-contributor video upload is 403 and BOTH files are removed', async () => {- const { user: owner } = createUser(testDb);- const { user: other } = createUser(testDb);- const journey = createJourney(testDb, owner.id);+ const { user: owner } = await makeUser(orm);+ const { user: other } = await makeUser(orm);+ const journey = await makeJourney(orm, owner.id);const before = fsMod.existsSync(journeyDir) ? fsMod.readdirSync(journeyDir).length : 0;const res = await request(app)@@ -1165,8 +1159,8 @@ describe('Journey upload parity', () => {});it('JOURNEY-P09 — cover upload stores journey/<uuid> into cover_image', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).post(`/api/journeys/${journey.id}/cover`)@@ -1214,9 +1208,9 @@ describe('Journey upload parity', () => {}it('JOURNEY-P10: an entry photo stores the instant from DateTimeOriginal plus its offset, and its GPS', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);- const entry = createJourneyEntry(testDb, journey.id, user.id, { entry_date: '2026-05-30' });+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);+ const entry = await makeJourneyEntry(orm, journey.id, user.id, { entry_date: '2026-05-30' });const res = await request(app).post(`/api/journeys/entries/${entry.id}/photos`)@@ -1232,8 +1226,8 @@ describe('Journey upload parity', () => {});it('JOURNEY-P11: a gallery photo gets the same', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).post(`/api/journeys/${journey.id}/gallery/photos`)@@ -1248,8 +1242,8 @@ describe('Journey upload parity', () => {});it('JOURNEY-P12: zeros in the GPS block, as a receiver without a fix writes them, put no pin at 0,0', async () => {- const { user } = createUser(testDb);- const journey = createJourney(testDb, user.id);+ const { user } = await makeUser(orm);+ const journey = await makeJourney(orm, user.id);const res = await request(app).post(`/api/journeys/${journey.id}/gallery/photos`)diff --git a/server/tests/integration/packing.test.ts b/server/tests/integration/packing.test.tsindex b93903849..576d13d96 100644--- a/server/tests/integration/packing.test.ts+++ b/server/tests/integration/packing.test.ts@@ -3,27 +3,24 @@* Covers PACK-001 to PACK-014.*/import { buildApp } from '../../src/bootstrap';-import { db as testDb } from '../../src/db/database';import { PackingItems } from '../../src/db/entities/PackingItems.entity';import { PackingTemplateCategories } from '../../src/db/entities/PackingTemplateCategories.entity';import { PackingTemplateItems } from '../../src/db/entities/PackingTemplateItems.entity';import { PackingTemplates } from '../../src/db/entities/PackingTemplates.entity';import { authCookie } from '../helpers/auth';-import { createUser, createTrip, createPackingItem, addTripMember } from '../helpers/factories';import type { FactoryOrm } from '../helpers/factories/context';+import { makePackingItem } from '../helpers/factories/packing';import { findRows, insertRow } from '../helpers/factories/rows';-import { resetTestDb, resetRateLimits } from '../helpers/test-db';+import { addTripMember, makeTrip } from '../helpers/factories/trips';+import { makeUser } from '../helpers/factories/users';+import { resetDatabase } from '../helpers/reset-database';+import { resetRateLimits } from '../helpers/test-db';import { MikroORM } from '@mikro-orm/core';import type { INestApplication } from '@nestjs/common';import type { Application } from 'express';import request from 'supertest';-import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';--vi.mock('../../src/db/database', async () => {- const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');- return buildDbMock(createSnapshotTestDb());-});+import { describe, it, expect, beforeAll, beforeEach, afterAll } from 'vitest';let nestApp: INestApplication;let app: Application;@@ -36,13 +33,12 @@ beforeAll(async () => {});beforeEach(async () => {- resetTestDb(testDb);+ await resetDatabase(orm);await resetRateLimits(nestApp);});afterAll(async () => {await nestApp.close();- testDb.close();});// ─────────────────────────────────────────────────────────────────────────────@@ -51,8 +47,8 @@ afterAll(async () => {describe('Create packing item', () => {it('PACK-001 — POST creates a packing item', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).post(`/api/trips/${trip.id}/packing`)@@ -65,8 +61,8 @@ describe('Create packing item', () => {});it('PACK-001 — POST without name returns 400', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).post(`/api/trips/${trip.id}/packing`)@@ -76,9 +72,9 @@ describe('Create packing item', () => {});it('PACK-014 — non-member cannot create packing item', async () => {- const { user: owner } = createUser(testDb);- const { user: other } = createUser(testDb);- const trip = createTrip(testDb, owner.id);+ const { user: owner } = await makeUser(orm);+ const { user: other } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);const res = await request(app).post(`/api/trips/${trip.id}/packing`)@@ -94,10 +90,10 @@ describe('Create packing item', () => {describe('List packing items', () => {it('PACK-002 — GET /api/trips/:tripId/packing returns all items', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- createPackingItem(testDb, trip.id, { name: 'Toothbrush', category: 'Toiletries' });- createPackingItem(testDb, trip.id, { name: 'Shirt', category: 'Clothing' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await makePackingItem(orm, trip.id, { name: 'Toothbrush', category: 'Toiletries' });+ await makePackingItem(orm, trip.id, { name: 'Shirt', category: 'Clothing' });const res = await request(app).get(`/api/trips/${trip.id}/packing`).set('Cookie', authCookie(user.id));expect(res.status).toBe(200);@@ -105,11 +101,11 @@ describe('List packing items', () => {});it('PACK-002 — member can list packing items', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);- createPackingItem(testDb, trip.id, { name: 'Jacket' });+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, member.id);+ await makePackingItem(orm, trip.id, { name: 'Jacket' });const res = await request(app).get(`/api/trips/${trip.id}/packing`).set('Cookie', authCookie(member.id));expect(res.status).toBe(200);@@ -123,10 +119,10 @@ describe('List packing items', () => {describe('Private packing items (#858)', () => {it('PACK-PRIV-001 — a private item is hidden from other members but visible to its owner', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, member.id);// Owner creates one shared and one private item.await request(app)@@ -148,10 +144,10 @@ describe('Private packing items (#858)', () => {});it('PACK-PRIV-002 — toggling an item private hides it from other members', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, member.id);const created = await request(app).post(`/api/trips/${trip.id}/packing`)@@ -175,24 +171,24 @@ describe('Private packing items (#858)', () => {describe('Three-tier packing sharing (#858)', () => {it('PACK-3T-001 — existing items stay Common (visible to all) — non-breaking', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, member.id);// A pre-existing row (default is_private=0) must remain visible to everyone.- createPackingItem(testDb, trip.id, { name: 'Group tent' });+ await makePackingItem(orm, trip.id, { name: 'Group tent' });const memberView = await request(app).get(`/api/trips/${trip.id}/packing`).set('Cookie', authCookie(member.id));expect(memberView.body.items.map((i: any) => i.name)).toContain('Group tent');});it('PACK-3T-002 — a Shared item reaches the recipient (with the bringer) but no one else', async () => {- const { user: owner } = createUser(testDb);- const { user: friend } = createUser(testDb);- const { user: stranger } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, friend.id);- addTripMember(testDb, trip.id, stranger.id);+ const { user: owner } = await makeUser(orm);+ const { user: friend } = await makeUser(orm);+ const { user: stranger } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, friend.id);+ await addTripMember(orm, trip.id, stranger.id);const created = await request(app).post(`/api/trips/${trip.id}/packing`)@@ -208,10 +204,10 @@ describe('Three-tier packing sharing (#858)', () => {});it("PACK-3T-003 — clone copies a Common item onto the caller's personal list", async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, member.id);const created = await request(app).post(`/api/trips/${trip.id}/packing`).set('Cookie', authCookie(owner.id))@@ -229,10 +225,10 @@ describe('Three-tier packing sharing (#858)', () => {});it('PACK-3T-004 — "I can bring that too" adds the caller as a contributor on a Common item', async () => {- const { user: owner } = createUser(testDb);- const { user: helper } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, helper.id);+ const { user: owner } = await makeUser(orm);+ const { user: helper } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, helper.id);const created = await request(app).post(`/api/trips/${trip.id}/packing`).set('Cookie', authCookie(owner.id))@@ -246,11 +242,11 @@ describe('Three-tier packing sharing (#858)', () => {});it('PACK-3T-004b — a member puts someone else down as the bringer, and takes the owner off again (#3098)', async () => {- const { user: owner } = createUser(testDb);- const { user: helper } = createUser(testDb);- const { user: stranger } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, helper.id);+ const { user: owner } = await makeUser(orm);+ const { user: helper } = await makeUser(orm);+ const { user: stranger } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, helper.id);const created = await request(app).post(`/api/trips/${trip.id}/packing`).set('Cookie', authCookie(owner.id))@@ -289,10 +285,10 @@ describe('Three-tier packing sharing (#858)', () => {});it('PACK-3T-005 — sharing can only be changed by the owner', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, member.id);const created = await request(app).post(`/api/trips/${trip.id}/packing`).set('Cookie', authCookie(owner.id))@@ -325,9 +321,9 @@ describe('Three-tier packing sharing (#858)', () => {describe('Update packing item', () => {it('PACK-003 — PUT updates packing item (toggle checked)', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const item = createPackingItem(testDb, trip.id, { name: 'Camera' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const item = await makePackingItem(orm, trip.id, { name: 'Camera' });const res = await request(app).put(`/api/trips/${trip.id}/packing/${item.id}`)@@ -338,8 +334,8 @@ describe('Update packing item', () => {});it('PACK-003 — PUT returns 404 for non-existent item', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).put(`/api/trips/${trip.id}/packing/99999`)@@ -355,9 +351,9 @@ describe('Update packing item', () => {describe('Delete packing item', () => {it('PACK-004 — DELETE removes packing item', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const item = createPackingItem(testDb, trip.id, { name: 'Sunglasses' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const item = await makePackingItem(orm, trip.id, { name: 'Sunglasses' });const del = await request(app).delete(`/api/trips/${trip.id}/packing/${item.id}`)@@ -376,8 +372,8 @@ describe('Delete packing item', () => {describe('Bulk import packing items', () => {it('PACK-005 — POST /import creates multiple items at once', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).post(`/api/trips/${trip.id}/packing/import`)@@ -395,8 +391,8 @@ describe('Bulk import packing items', () => {});it('PACK-005 — POST /import with empty array returns 400', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).post(`/api/trips/${trip.id}/packing/import`)@@ -412,10 +408,10 @@ describe('Bulk import packing items', () => {describe('Reorder packing items', () => {it('PACK-006 — PUT /reorder reorders items', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const i1 = createPackingItem(testDb, trip.id, { name: 'Item A' });- const i2 = createPackingItem(testDb, trip.id, { name: 'Item B' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const i1 = await makePackingItem(orm, trip.id, { name: 'Item A' });+ const i2 = await makePackingItem(orm, trip.id, { name: 'Item B' });const res = await request(app).put(`/api/trips/${trip.id}/packing/reorder`)@@ -436,8 +432,8 @@ describe('Reorder packing items', () => {describe('Bags', () => {it('PACK-008 — POST /bags creates a bag', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).post(`/api/trips/${trip.id}/packing/bags`)@@ -448,8 +444,8 @@ describe('Bags', () => {});it('PACK-008 — POST /bags without name returns 400', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).post(`/api/trips/${trip.id}/packing/bags`)@@ -459,8 +455,8 @@ describe('Bags', () => {});it('PACK-011 — GET /bags returns bags list', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);// Create a bagawait request(app).post(`/api/trips/${trip.id}/packing/bags`)@@ -473,8 +469,8 @@ describe('Bags', () => {});it('PACK-009 — PUT /bags/:bagId updates bag', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const createRes = await request(app).post(`/api/trips/${trip.id}/packing/bags`).set('Cookie', authCookie(user.id))@@ -490,8 +486,8 @@ describe('Bags', () => {});it('PACK-009b — H2 regression: PUT /bags/:bagId with an empty body no-ops (200, not 500)', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const createRes = await request(app).post(`/api/trips/${trip.id}/packing/bags`).set('Cookie', authCookie(user.id))@@ -508,8 +504,8 @@ describe('Bags', () => {});it('PACK-009c — H2 regression: PUT /bags/:bagId with an empty name no-ops (200, not 500)', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const createRes = await request(app).post(`/api/trips/${trip.id}/packing/bags`).set('Cookie', authCookie(user.id))@@ -525,8 +521,8 @@ describe('Bags', () => {});it('PACK-009d — H2 regression: PUT /bags/:bagId with an empty color no-ops (200, not 500)', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const createRes = await request(app).post(`/api/trips/${trip.id}/packing/bags`).set('Cookie', authCookie(user.id))@@ -542,8 +538,8 @@ describe('Bags', () => {});it('PACK-010 — DELETE /bags/:bagId removes bag', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const createRes = await request(app).post(`/api/trips/${trip.id}/packing/bags`).set('Cookie', authCookie(user.id))@@ -564,10 +560,10 @@ describe('Bags', () => {describe('Category assignees', () => {it('PACK-012 — PUT /category-assignees/:category sets assignees', async () => {- const { user } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, user.id);- addTripMember(testDb, trip.id, member.id);+ const { user } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await addTripMember(orm, trip.id, member.id);const res = await request(app).put(`/api/trips/${trip.id}/packing/category-assignees/Clothing`)@@ -578,10 +574,10 @@ describe('Category assignees', () => {});it('PACK-012b — H1 regression: a string trip id (the real REST shape) with a non-empty roster does not 500', async () => {- const { user } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, user.id);- addTripMember(testDb, trip.id, member.id);+ const { user } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await addTripMember(orm, trip.id, member.id);// `trip.id` is a number in the fixture, but the route param — like every// real REST call — arrives as a string; `insertIgnore` used to hand that@@ -596,8 +592,8 @@ describe('Category assignees', () => {});it('PACK-013 — GET /category-assignees returns all category assignments', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);// Set an assignee firstawait request(app).put(`/api/trips/${trip.id}/packing/category-assignees/Electronics`)@@ -614,8 +610,8 @@ describe('Category assignees', () => {describe('Packing — apply-template, bag members, save-as-template', () => {it('PACK-015 — POST /apply-template/:templateId applies template items to trip', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const templateId = await insertRow(orm, PackingTemplates, { name: 'Beach', createdByRef: user.id });const categoryId = await insertRow(orm, PackingTemplateCategories, {@@ -636,8 +632,8 @@ describe('Packing — apply-template, bag members, save-as-template', () => {});it('PACK-015b — POST /apply-template/:id for empty template returns 404', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);// Template with no itemsconst emptyTemplateId = await insertRow(orm, PackingTemplates, { name: 'Empty', createdByRef: user.id });@@ -651,10 +647,10 @@ describe('Packing — apply-template, bag members, save-as-template', () => {});it('PACK-016 — PUT /bags/:bagId/members sets bag members', async () => {- const { user } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, user.id);- addTripMember(testDb, trip.id, member.id);+ const { user } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await addTripMember(orm, trip.id, member.id);// Create a bag firstconst bagRes = await request(app)@@ -675,8 +671,8 @@ describe('Packing — apply-template, bag members, save-as-template', () => {});it('PACK-016b — PUT /bags/:bagId/members for non-existent bag returns 404', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).put(`/api/trips/${trip.id}/packing/bags/999999/members`)@@ -688,11 +684,11 @@ describe('Packing — apply-template, bag members, save-as-template', () => {});it('PACK-017 — POST /save-as-template saves packing list as a template (admin)', async () => {- const { user } = createUser(testDb, { role: 'admin' });- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm, { role: 'admin' });+ const trip = await makeTrip(orm, user.id);// Add an item so the trip has something to save- createPackingItem(testDb, trip.id);+ await makePackingItem(orm, trip.id);const res = await request(app).post(`/api/trips/${trip.id}/packing/save-as-template`)@@ -705,8 +701,8 @@ describe('Packing — apply-template, bag members, save-as-template', () => {});it('PACK-017b — POST /save-as-template without name returns 400 (admin)', async () => {- const { user } = createUser(testDb, { role: 'admin' });- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm, { role: 'admin' });+ const trip = await makeTrip(orm, user.id);const res = await request(app).post(`/api/trips/${trip.id}/packing/save-as-template`)@@ -718,8 +714,8 @@ describe('Packing — apply-template, bag members, save-as-template', () => {});it('PACK-017c — POST /save-as-template when trip has no items returns 400 (admin)', async () => {- const { user } = createUser(testDb, { role: 'admin' });- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm, { role: 'admin' });+ const trip = await makeTrip(orm, user.id);const res = await request(app).post(`/api/trips/${trip.id}/packing/save-as-template`)@@ -731,9 +727,9 @@ describe('Packing — apply-template, bag members, save-as-template', () => {});it('PACK-017d — POST /save-as-template is forbidden for non-admins (403)', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- createPackingItem(testDb, trip.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await makePackingItem(orm, trip.id);const res = await request(app).post(`/api/trips/${trip.id}/packing/save-as-template`)@@ -745,9 +741,9 @@ describe('Packing — apply-template, bag members, save-as-template', () => {});it('PACK-017e — GET /packing/templates lists templates for a trip member', async () => {- const { user: admin } = createUser(testDb, { role: 'admin' });- const trip = createTrip(testDb, admin.id);- createPackingItem(testDb, trip.id);+ const { user: admin } = await makeUser(orm, { role: 'admin' });+ const trip = await makeTrip(orm, admin.id);+ await makePackingItem(orm, trip.id);await request(app).post(`/api/trips/${trip.id}/packing/save-as-template`).set('Cookie', authCookie(admin.id))diff --git a/server/tests/integration/reservations.test.ts b/server/tests/integration/reservations.test.tsindex 8781a867c..9dde15e85 100644--- a/server/tests/integration/reservations.test.ts+++ b/server/tests/integration/reservations.test.ts@@ -3,35 +3,26 @@* Covers RESV-001 to RESV-007.*/import { buildApp } from '../../src/bootstrap';-import { db as testDb } from '../../src/db/database';import { BudgetItems } from '../../src/db/entities/BudgetItems.entity';import { DayAccommodations } from '../../src/db/entities/DayAccommodations.entity';import { Days } from '../../src/db/entities/Days.entity';import { ReservationDayPositions } from '../../src/db/entities/ReservationDayPositions.entity';import { Reservations } from '../../src/db/entities/Reservations.entity';import { authCookie } from '../helpers/auth';-import {- createUser,- createTrip,- createDay,- createPlace,- createReservation,- createDayAssignment,- addTripMember,-} from '../helpers/factories';+import { makeDayAssignment } from '../helpers/factories/itinerary';+import { makePlace } from '../helpers/factories/places';+import { makeReservation } from '../helpers/factories/reservations';import { findRow, findRows, updateRows } from '../helpers/factories/rows';-import { resetTestDb, resetRateLimits } from '../helpers/test-db';+import { makeDay, makeTrip } from '../helpers/factories/trips';+import { makeUser } from '../helpers/factories/users';+import { resetDatabase } from '../helpers/reset-database';+import { resetRateLimits } from '../helpers/test-db';import { MikroORM } from '@mikro-orm/core';import type { INestApplication } from '@nestjs/common';import type { Application } from 'express';import request from 'supertest';-import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';--vi.mock('../../src/db/database', async () => {- const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');- return buildDbMock(createSnapshotTestDb());-});+import { describe, it, expect, beforeAll, beforeEach, afterAll } from 'vitest';let orm: MikroORM;@@ -50,13 +41,12 @@ beforeAll(async () => {});beforeEach(async () => {- resetTestDb(testDb);+ await resetDatabase(orm);await resetRateLimits(nestApp);});afterAll(async () => {await nestApp.close();- testDb.close();});// ─────────────────────────────────────────────────────────────────────────────@@ -65,8 +55,8 @@ afterAll(async () => {describe('Create reservation', () => {it('RESV-001 — POST /api/trips/:tripId/reservations creates a reservation', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -78,8 +68,8 @@ describe('Create reservation', () => {});it('RESV-001b — persists and updates the dedicated url field (#935)', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const created = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -97,8 +87,8 @@ describe('Create reservation', () => {});it('RESV-001 — POST without title returns 400', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -108,9 +98,9 @@ describe('Create reservation', () => {});it('RESV-001 — non-member cannot create reservation', async () => {- const { user: owner } = createUser(testDb);- const { user: other } = createUser(testDb);- const trip = createTrip(testDb, owner.id);+ const { user: owner } = await makeUser(orm);+ const { user: other } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);const res = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -120,9 +110,9 @@ describe('Create reservation', () => {});it('RESV-002 — POST with create_accommodation creates an accommodation record', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const day = createDay(testDb, trip.id, { date: '2025-06-01' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const day = await makeDay(orm, trip.id, { date: '2025-06-01' });const res = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -139,10 +129,10 @@ describe('Create reservation', () => {describe('List reservations', () => {it('RESV-003 — GET /api/trips/:tripId/reservations returns all reservations', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- createReservation(testDb, trip.id, { title: 'Flight Out', type: 'flight' });- createReservation(testDb, trip.id, { title: 'Hotel Stay', type: 'hotel' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await makeReservation(orm, trip.id, { title: 'Flight Out', type: 'flight' });+ await makeReservation(orm, trip.id, { title: 'Hotel Stay', type: 'hotel' });const res = await request(app).get(`/api/trips/${trip.id}/reservations`).set('Cookie', authCookie(user.id));expect(res.status).toBe(200);@@ -150,8 +140,8 @@ describe('List reservations', () => {});it('RESV-003 — returns empty array when no reservations exist', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).get(`/api/trips/${trip.id}/reservations`).set('Cookie', authCookie(user.id));expect(res.status).toBe(200);@@ -159,9 +149,9 @@ describe('List reservations', () => {});it('RESV-007 — non-member cannot list reservations', async () => {- const { user: owner } = createUser(testDb);- const { user: other } = createUser(testDb);- const trip = createTrip(testDb, owner.id);+ const { user: owner } = await makeUser(orm);+ const { user: other } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);const res = await request(app).get(`/api/trips/${trip.id}/reservations`).set('Cookie', authCookie(other.id));expect(res.status).toBe(404);@@ -174,9 +164,9 @@ describe('List reservations', () => {describe('Update reservation', () => {it('RESV-004 — PUT updates reservation fields', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const resv = createReservation(testDb, trip.id, { title: 'Old Flight', type: 'flight' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const resv = await makeReservation(orm, trip.id, { title: 'Old Flight', type: 'flight' });const res = await request(app).put(`/api/trips/${trip.id}/reservations/${resv.id}`)@@ -188,11 +178,11 @@ describe('Update reservation', () => {});it('RESV-004b — PUT with day_id null derives day_id from reservation_time so it stays in the Plan (#1237)', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- createDay(testDb, trip.id, { date: '2025-09-01' });- const day2 = createDay(testDb, trip.id, { date: '2025-09-02' });- const resv = createReservation(testDb, trip.id, { title: 'Event', type: 'event' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await makeDay(orm, trip.id, { date: '2025-09-01' });+ const day2 = await makeDay(orm, trip.id, { date: '2025-09-02' });+ const resv = await makeReservation(orm, trip.id, { title: 'Event', type: 'event' });const res = await request(app).put(`/api/trips/${trip.id}/reservations/${resv.id}`)@@ -203,10 +193,10 @@ describe('Update reservation', () => {});it('RESV-004c — re-dating a booking moves it to the matching day (start + end) (#1237)', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const day1 = createDay(testDb, trip.id, { date: '2025-10-01' });- const day3 = createDay(testDb, trip.id, { date: '2025-10-03' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const day1 = await makeDay(orm, trip.id, { date: '2025-10-01' });+ const day3 = await makeDay(orm, trip.id, { date: '2025-10-03' });// Booking sits on day 1 (start + end).const created = await request(app)@@ -237,8 +227,8 @@ describe('Update reservation', () => {});it('RESV-004 — PUT on non-existent reservation returns 404', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).put(`/api/trips/${trip.id}/reservations/99999`)@@ -248,11 +238,11 @@ describe('Update reservation', () => {});it('RESV-010 — PUT syncs check-in/out times to linked accommodation', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const day1 = createDay(testDb, trip.id, { date: '2025-08-01' });- const day2 = createDay(testDb, trip.id, { date: '2025-08-03' });- const place = createPlace(testDb, trip.id, { name: 'Sync Hotel' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const day1 = await makeDay(orm, trip.id, { date: '2025-08-01' });+ const day2 = await makeDay(orm, trip.id, { date: '2025-08-03' });+ const place = await makePlace(orm, trip.id, { name: 'Sync Hotel' });// Create reservation with linked accommodationconst createRes = await request(app)@@ -290,17 +280,17 @@ describe('Update reservation', () => {// legacy raw-bind existence check's own affinity never converts a hex// string, so it always stored NULL instead.it('L2 — PUT with a hex-spelled accommodation_id stores NULL, matching the legacy affinity miss', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const day = createDay(testDb, trip.id);- const place = createPlace(testDb, trip.id, { name: 'Hotel' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const day = await makeDay(orm, trip.id);+ const place = await makePlace(orm, trip.id, { name: 'Hotel' });const { accommodation: accom } = (await request(app).post(`/api/trips/${trip.id}/accommodations`).set('Cookie', authCookie(user.id)).send({ place_id: place.id, start_day_id: day.id, end_day_id: day.id })).body as { accommodation: { id: number } };- const resv = createReservation(testDb, trip.id, { title: 'Flight', type: 'flight' });+ const resv = await makeReservation(orm, trip.id, { title: 'Flight', type: 'flight' });const hexAccId = '0x' + accom.id.toString(16);const res = await request(app)@@ -328,11 +318,11 @@ describe('Update reservation', () => {describe("H1 — a booking on a stay is restamped when the trip's dates change (DY23)", () => {it('the accommodation_id RS28 stores is the legacy REAL-bound TEXT shape, and a later date change restamps the linked booking', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id, { start_date: '2026-12-01', end_date: '2026-12-03' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id, { start_date: '2026-12-01', end_date: '2026-12-03' });const day1 = (await findRow(orm, Days, { trip: trip.id, date: '2026-12-01' }))!;const day2 = (await findRow(orm, Days, { trip: trip.id, date: '2026-12-02' }))!;- const place = createPlace(testDb, trip.id, { name: 'Lighthouse Inn' });+ const place = await makePlace(orm, trip.id, { name: 'Lighthouse Inn' });const createRes = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -380,11 +370,11 @@ describe("H1 — a booking on a stay is restamped when the trip's dates change (describe('RS22 — assignment_id foreign-reference check on POST /reservations', () => {it('RS22-own: an assignment_id belonging to the SAME trip is accepted (201)', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const day = createDay(testDb, trip.id);- const place = createPlace(testDb, trip.id);- const assignment = createDayAssignment(testDb, day.id, place.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const day = await makeDay(orm, trip.id);+ const place = await makePlace(orm, trip.id);+ const assignment = await makeDayAssignment(orm, day.id, place.id);const res = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -395,12 +385,12 @@ describe('RS22 — assignment_id foreign-reference check on POST /reservations',});it('RS22-foreign: an assignment_id belonging to a DIFFERENT trip is refused (400 "Not part of this trip: assignment_id")', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const otherTrip = createTrip(testDb, user.id);- const otherDay = createDay(testDb, otherTrip.id);- const otherPlace = createPlace(testDb, otherTrip.id);- const foreignAssignment = createDayAssignment(testDb, otherDay.id, otherPlace.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const otherTrip = await makeTrip(orm, user.id);+ const otherDay = await makeDay(orm, otherTrip.id);+ const otherPlace = await makePlace(orm, otherTrip.id);+ const foreignAssignment = await makeDayAssignment(orm, otherDay.id, otherPlace.id);const res = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -411,8 +401,8 @@ describe('RS22 — assignment_id foreign-reference check on POST /reservations',});it('RS22-missing: an assignment_id that resolves to nothing is refused (400 "Unknown reference: assignment_id")', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -429,9 +419,9 @@ describe('RS22 — assignment_id foreign-reference check on POST /reservations',describe('Delete reservation', () => {it('RESV-005 — DELETE removes reservation', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const resv = createReservation(testDb, trip.id, { title: 'Flight', type: 'flight' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const resv = await makeReservation(orm, trip.id, { title: 'Flight', type: 'flight' });const del = await request(app).delete(`/api/trips/${trip.id}/reservations/${resv.id}`)@@ -444,8 +434,8 @@ describe('Delete reservation', () => {});it('RESV-005 — DELETE non-existent reservation returns 404', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).delete(`/api/trips/${trip.id}/reservations/99999`)@@ -458,9 +448,9 @@ describe('Delete reservation', () => {// real row and delete it, where the legacy raw-bind statement's affinity// never converts a hex string and so 404'd. Rule 21.it('M4 — DELETE …/reservations/0x<id> answers the legacy 404 and deletes nothing', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const resv = createReservation(testDb, trip.id, { title: 'Flight', type: 'flight' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const resv = await makeReservation(orm, trip.id, { title: 'Flight', type: 'flight' });const hexId = '0x' + resv.id.toString(16);const res = await request(app)@@ -479,10 +469,10 @@ describe('Delete reservation', () => {describe('Batch update positions', () => {it('RESV-006 — PUT /positions updates reservation sort order', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const r1 = createReservation(testDb, trip.id, { title: 'First', type: 'flight' });- const r2 = createReservation(testDb, trip.id, { title: 'Second', type: 'hotel' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const r1 = await makeReservation(orm, trip.id, { title: 'First', type: 'flight' });+ const r2 = await makeReservation(orm, trip.id, { title: 'Second', type: 'hotel' });const res = await request(app).put(`/api/trips/${trip.id}/reservations/positions`)@@ -503,10 +493,10 @@ describe('Batch update positions', () => {// where the legacy raw-bind statement's affinity never converts a hex// string, so the join matched no row (a quiet no-op, not a write). Rule 21.it('M4 — PUT /positions with a hex-spelled day_id is the legacy quiet no-op (no day-scoped row written)', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const day = createDay(testDb, trip.id, { date: '2026-01-01' });- const resv = createReservation(testDb, trip.id, { title: 'First', type: 'flight' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const day = await makeDay(orm, trip.id, { date: '2026-01-01' });+ const resv = await makeReservation(orm, trip.id, { title: 'First', type: 'flight' });const hexDayId = '0x' + day.id.toString(16);const res = await request(app)@@ -529,8 +519,8 @@ describe('Batch update positions', () => {describe('Reservation budget entry integration', () => {it('RESV-011 — POST with create_budget_entry auto-creates a linked budget item', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -549,8 +539,8 @@ describe('Reservation budget entry integration', () => {});it('RESV-011b — POST with create_budget_entry.total_price = 0 skips budget creation', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const res = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -567,9 +557,9 @@ describe('Reservation budget entry integration', () => {});it('RESV-012 — PUT with create_budget_entry creates a new budget item when none exists', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const resv = createReservation(testDb, trip.id, { title: 'Hotel Stay', type: 'hotel' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const resv = await makeReservation(orm, trip.id, { title: 'Hotel Stay', type: 'hotel' });const res = await request(app).put(`/api/trips/${trip.id}/reservations/${resv.id}`)@@ -583,8 +573,8 @@ describe('Reservation budget entry integration', () => {});it('RESV-013 — PUT with create_budget_entry updates existing linked budget item', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);// Create reservation with budget entry via POSTconst createRes = await request(app)@@ -611,8 +601,8 @@ describe('Reservation budget entry integration', () => {});it('RESV-014 — PUT without create_budget_entry keeps the existing linked budget item', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);// Create with budget entryconst createRes = await request(app)@@ -642,8 +632,8 @@ describe('Reservation budget entry integration', () => {});it('RESV-014b — PUT with create_budget_entry total_price 0 removes the linked budget item', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const createRes = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -668,8 +658,8 @@ describe('Reservation budget entry integration', () => {});it('RESV-014c — changing the booking type updates the linked expense category', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const createRes = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -688,8 +678,8 @@ describe('Reservation budget entry integration', () => {});it('RESV-014d — a manually-picked expense category survives a booking type change', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);const createRes = await request(app).post(`/api/trips/${trip.id}/reservations`)@@ -712,11 +702,11 @@ describe('Reservation budget entry integration', () => {describe('Reservation accommodation delete', () => {it('RESV-009 — DELETE reservation linked to accommodation also removes the accommodation', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const day1 = createDay(testDb, trip.id, { date: '2025-07-01' });- const day2 = createDay(testDb, trip.id, { date: '2025-07-03' });- const place = createPlace(testDb, trip.id, { name: 'Hotel Belle' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const day1 = await makeDay(orm, trip.id, { date: '2025-07-01' });+ const day2 = await makeDay(orm, trip.id, { date: '2025-07-03' });+ const place = await makePlace(orm, trip.id, { name: 'Hotel Belle' });// Create a reservation via API with create_accommodation as an objectconst createRes = await request(app)@@ -750,11 +740,11 @@ describe('Reservation accommodation delete', () => {});it('RESV-009b — DELETE reservation linked to accommodation also removes its linked budget item (issue #933)', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- const day1 = createDay(testDb, trip.id, { date: '2025-08-01' });- const day2 = createDay(testDb, trip.id, { date: '2025-08-03' });- const place = createPlace(testDb, trip.id, { name: 'Seaside Resort' });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ const day1 = await makeDay(orm, trip.id, { date: '2025-08-01' });+ const day2 = await makeDay(orm, trip.id, { date: '2025-08-03' });+ const place = await makePlace(orm, trip.id, { name: 'Seaside Resort' });const createRes = await request(app).post(`/api/trips/${trip.id}/reservations`)diff --git a/server/tests/postgres/snapshot-suites-baseline.json b/server/tests/postgres/snapshot-suites-baseline.jsonindex 0436b2203..448062092 100644--- a/server/tests/postgres/snapshot-suites-baseline.json+++ b/server/tests/postgres/snapshot-suites-baseline.json@@ -1,5 +1,4 @@[- "tests/integration/journey.test.ts","tests/integration/leg-mode-incoming.test.ts","tests/integration/legacy-upgrade-v066.test.ts","tests/integration/legacy-upgrade-v082.test.ts",@@ -12,9 +11,7 @@"tests/integration/memories-unified.test.ts","tests/integration/oauth-authorize.test.ts","tests/integration/oauth.test.ts",- "tests/integration/packing.test.ts","tests/integration/places.test.ts",- "tests/integration/reservations.test.ts","tests/integration/scheduler-gate.test.ts","tests/integration/security.test.ts","tests/integration/settings.test.ts",