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(import): stop the upload fixtures lying about their size
Maurice1d9fe9a3df2b
diff --git a/client/src/components/Planner/BookingImportModal.test.tsx b/client/src/components/Planner/BookingImportModal.test.tsxindex 16ed99d4a..ea5cdcdb9 100644--- a/client/src/components/Planner/BookingImportModal.test.tsx+++ b/client/src/components/Planner/BookingImportModal.test.tsx@@ -12,9 +12,13 @@ vi.mock('../../db/offlineDb', () => ({ saveImportFiles: vi.fn(async () => {}) })const defaultProps = { isOpen: true, onClose: vi.fn(), tripId: 4 };+// A file that is actually uploaded has to carry as many bytes as it reports —+// a size that lies leaves the multipart body and its length disagreeing, and the+// upload then fails to parse. Only the oversize case fakes the number, and that+// file is rejected by validateFile before it is ever sent.const eml = (name = 'booking.eml', size = 100) => {- const f = new File(['x'], name, { type: 'message/rfc822' });- Object.defineProperty(f, 'size', { value: size });+ const f = new File(['x'.repeat(Math.min(size, 4096))], name, { type: 'message/rfc822' });+ if (size > 4096) Object.defineProperty(f, 'size', { value: size });return f;};diff --git a/client/src/components/Planner/FileImportModal.test.tsx b/client/src/components/Planner/FileImportModal.test.tsxindex d77c603bb..fe4ee533f 100644--- a/client/src/components/Planner/FileImportModal.test.tsx+++ b/client/src/components/Planner/FileImportModal.test.tsx@@ -19,9 +19,11 @@ vi.mock('../shared/Toast', () => ({const defaultProps = { isOpen: true, onClose: vi.fn(), tripId: 3 };+// See BookingImportModal.test.tsx: a file that is really uploaded must carry as+// many bytes as it reports, otherwise the multipart body and its length disagree.const gpx = (name = 'route.gpx', size = 100) => {- const f = new File(['<gpx/>'], name, { type: 'application/gpx+xml' });- Object.defineProperty(f, 'size', { value: size });+ const f = new File(['<gpx/>'.padEnd(Math.min(size, 4096), ' ')], name, { type: 'application/gpx+xml' });+ if (size > 4096) Object.defineProperty(f, 'size', { value: size });return f;};const kml = (name = 'places.kml') => new File(['<kml/>'], name, { type: 'application/vnd.google-earth.kml+xml' });