Files
TREK/client/tests/helpers/msw/handlers/shared.ts
T
Maurice ede109dce8 feat(journey): complete sharing, photo drafts and Studio maps
Connect the Journey backend to the web and mobile UI, including public access and subscriptions, day recordings, photo drafts and per-map framing. Preserve legacy recording responses and cover the new behavior in every locale.
2026-11-30 16:56:18 +01:00

39 lines
1.2 KiB
TypeScript

import { http, HttpResponse } from 'msw';
import { buildTrip, buildDay, buildPlace } from '../../factories';
export const sharedHandlers = [
http.post('/api/public/journey/:token/view', () => HttpResponse.json({ success: true })),
http.get('/api/shared/:token', ({ params }) => {
const { token } = params;
// What the share endpoint answers for an unknown, expired or revoked token.
if (token === 'invalid-token' || token === 'expired-token') {
return HttpResponse.json({ error: 'Invalid or expired link' }, { status: 404 });
}
const trip = { ...buildTrip({ start_date: '2026-07-01', end_date: '2026-07-05' }), title: 'Shared Paris Trip' };
const day1 = buildDay({ trip_id: trip.id, date: '2026-07-01' });
const place1 = buildPlace({ trip_id: trip.id, name: 'Eiffel Tower', lat: 48.8584, lng: 2.2945 });
return HttpResponse.json({
trip,
days: [day1],
assignments: {},
dayNotes: {},
places: [place1],
reservations: [],
accommodations: [],
packing: [],
budget: [],
categories: [],
permissions: {
share_bookings: true,
share_packing: false,
share_budget: false,
share_collab: false,
},
collab: [],
});
}),
];