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(assistant): the new end to end tests create their book inside a request context
Maurice7d736e1a34ba
diff --git a/server/tests/e2e/assistant-book-design.e2e.test.ts b/server/tests/e2e/assistant-book-design.e2e.test.tsindex c0f3baf32..fc2dc08c2 100644--- a/server/tests/e2e/assistant-book-design.e2e.test.ts+++ b/server/tests/e2e/assistant-book-design.e2e.test.ts@@ -24,6 +24,7 @@import { buildApp } from '../../src/bootstrap';import { JourneyBookRevisions } from '../../src/db/entities/JourneyBookRevisions.entity';import { JourneyContributors } from '../../src/db/entities/JourneyContributors.entity';+import { withRequestContext } from '../../src/nest/database/request-context';import { JourneyBookEditService } from '../../src/nest/journey/journey-book-edit.service';import { addJourneyContributor, makeJourney, makeJourneyEntry } from '../helpers/factories/journeys';import { countRows, findRow, updateRows } from '../helpers/factories/rows';@@ -246,7 +247,8 @@ async function journeyWithBook() {const journey = await makeJourney(orm, user.id, { title: 'Lisbon' });await makeJourneyEntry(orm, journey.id, user.id, { title: 'Alfama', story: 'Trams.', entry_date: '2026-05-02' });await makeJourneyEntry(orm, journey.id, user.id, { title: 'Belem', story: 'Pasteis.', entry_date: '2026-05-03' });- const created = await books.createBook(journey.id, user.id, {});+ // A service called from the test, not through a route, needs the request context a route gets.+ const created = await withRequestContext(orm, () => books.createBook(journey.id, user.id, {}));broadcasts.broadcastToUser.mockClear();return { ownerId: user.id, journeyId: journey.id, created, base: `/api/journeys/${journey.id}/assistant` };}diff --git a/server/tests/e2e/assistant-page-images.e2e.test.ts b/server/tests/e2e/assistant-page-images.e2e.test.tsindex a5823b02e..ab3d07219 100644--- a/server/tests/e2e/assistant-page-images.e2e.test.ts+++ b/server/tests/e2e/assistant-page-images.e2e.test.ts@@ -34,6 +34,7 @@ import { AnthropicMessagesClient } from '../../src/nest/ai-connections/providersimport { OpenAiChatClient } from '../../src/nest/ai-connections/providers/openai-chat.client';import { OpenAiResponsesClient } from '../../src/nest/ai-connections/providers/openai-responses.client';import type { AiFetch } from '../../src/nest/ai-connections/providers/provider-http';+import { withRequestContext } from '../../src/nest/database/request-context';import { JourneyBookEditService } from '../../src/nest/journey/journey-book-edit.service';import { makeJourney } from '../helpers/factories/journeys';import { setAddonEnabled } from '../helpers/factories/settings';@@ -281,7 +282,8 @@ function studioTab(journeyId: number, userId: number) {async function ownerWithBook() {const { user } = await makeUser(orm);const journey = await makeJourney(orm, user.id, { title: 'Portugal by train' });- const created = await books.createBook(journey.id, user.id, {});+ // A service called from the test, not through a route, needs the request context a route gets.+ const created = await withRequestContext(orm, () => books.createBook(journey.id, user.id, {}));const inner = created.pages.find((page) => page.role === 'inner')?.id ?? 'no inner page';return { userId: user.id, journeyId: journey.id, inner, base: `/api/journeys/${journey.id}/assistant` };}