fix(journey,tours): read a day's stays as a read, give the services the request context in the e2e runs and hold the tests to the foot-only walks and the translated notices

This commit is contained in:
Maurice
2026-10-21 21:16:36 +02:00
parent ef4eac34c4
commit 3101b36f3d
11 changed files with 44 additions and 26 deletions
@@ -501,9 +501,10 @@ function JourneyMapGL(
// fit bounds to all points
const known = marksRef.current ?? []
marksFramedRef.current = known.length > 0
known.forEach(mark => bounds.extend([mark.lng, mark.lat]))
if (hasPoints || known.length > 0) {
try {
map.fitBounds(markBounds(gl, known, entryPointsRef.current), fitOptions(paddingBottom, enableMapbox3d && fullScreen))
map.fitBounds(bounds, fitOptions(paddingBottom, enableMapbox3d && fullScreen))
} catch { /* empty bounds */ }
}
})
@@ -152,7 +152,7 @@ describe('useJourneyDayImport', () => {
await act(async () => result.current.submit());
expect(toast.success).not.toHaveBeenCalled();
expect(toast.info).toHaveBeenCalledWith('2 stays were in the journal already. Nothing was written twice.');
expect(toast.info).toHaveBeenCalledWith('2 stays were taken over already. Nothing was written twice.');
expect(repo.save).not.toHaveBeenCalled();
});
@@ -103,7 +103,7 @@ describe('useJourneyRecordingPrep', () => {
await act(async () => {
await result.current.setEnabled(true);
});
expect(toast.error).toHaveBeenCalledWith('Failed to save');
expect(toast.error).toHaveBeenCalledWith('journey.settings.saveFailed');
expect(opts.onSwitched).not.toHaveBeenCalled();
expect(dawarich.syncNow).not.toHaveBeenCalled();
});
@@ -124,7 +124,7 @@ describe('useJourneyRecordingPrep', () => {
await act(async () => {
await result.current.fetchNow();
});
expect(toast.error).toHaveBeenCalledWith('Dawarich could not be asked right now.');
expect(toast.error).toHaveBeenCalledWith('journey.prep.fetchFailed');
await waitFor(() => expect(repo.prep).toHaveBeenCalledTimes(3));
});
@@ -136,9 +136,7 @@ describe('useJourneyRecordingPrep', () => {
await act(async () => {
await result.current.fetchNow();
});
expect(toast.info).toHaveBeenCalledWith(
'A fetch is already running in the background. Its stays show up once it is through.'
);
expect(toast.info).toHaveBeenCalledWith('journey.prep.alreadyRunning');
});
it('FE-JRN-PREP-HOOK-007: a journey whose trips all ended out of reach marks no day and offers no fetch', async () => {
@@ -149,7 +147,7 @@ describe('useJourneyRecordingPrep', () => {
expect(result.current.dayPrep('2026-05-14')).toBeNull();
expect(result.current.canFetch).toBe(false);
expect(result.current.statusLine).toEqual({
text: 'Trips that ended more than 400 days ago are not prepared in the background. Open one of their days to fetch it by hand.',
text: 'journey.prep.outOfReach',
tone: 'warning',
});
});
@@ -63,6 +63,7 @@ const searchPlanner = (over: Partial<TourPlannerController> = {}) =>
tourType: 'hike',
route: ROUTE,
mode: { type: 'edit-saved', placeId: 9 },
waypoints: [],
...over,
}) as TourPlannerController;
@@ -720,7 +721,9 @@ describe('e-bike charging along a bike tour (BIK-07)', () => {
points: TourPlannerWaypoint[]
) => TourPlannerWaypoint[];
const added = normalizePlannerWaypoints(updater(POINTS)).find((point) => point.lat === CHARGER.lat);
expect(added).toMatchObject({ lng: CHARGER.lng, name: 'E-bike charging' });
// Unnamed, it keeps no name of its own, as every unnamed place does; its row shows the kind.
expect(added).toMatchObject({ lng: CHARGER.lng, poiCategory: 'ebike_charging' });
expect(added).not.toHaveProperty('name');
});
it('FE-TOUR-POI-029: a point that only lets bikes charge says so, and an unstated plug is dimmed, never named', async () => {