mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-22 06:56:35 +00:00
fix(tours): read e-bike chargers as mapped, keep unnamed ones on the map search
This commit is contained in:
@@ -28,11 +28,12 @@ const HOUSEHOLD_SOCKETS: ReadonlySet<string> = new Set([
|
||||
|
||||
type Translate = ReturnType<typeof useTranslation>['t'];
|
||||
|
||||
/** OpenStreetMap's access values, read as one of three answers; any other is left unsaid. */
|
||||
/** OpenStreetMap's access values, read as one of four answers; any other is left unsaid. */
|
||||
function accessLabel(access: string | null, t: Translate) {
|
||||
if (access === 'yes' || access === 'permissive' || access === 'public') return t('tours.poi.charging.access.public');
|
||||
if (access === 'customers') return t('tours.poi.charging.access.customers');
|
||||
if (access === 'private' || access === 'no') return t('tours.poi.charging.access.private');
|
||||
if (access === 'private') return t('tours.poi.charging.access.private');
|
||||
if (access === 'no') return t('tours.poi.charging.access.none');
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,8 +109,11 @@ export function SearchNotices({ search, unit }: { search: TourPoiSearch; unit: U
|
||||
const searchedAll = answer.unavailable.length === 0 && !answer.partial && !search.outdated;
|
||||
const empty = answer.pois.length === 0 && searchedAll;
|
||||
// BIK-07: few chargers are tagged for bikes, so none found is said, not left to look like a fault.
|
||||
// A cut answer may have lost them to the cut, which its own note already says.
|
||||
const noChargers =
|
||||
searchedAll &&
|
||||
!answer.truncated &&
|
||||
!answer.capped &&
|
||||
search.categories.includes('ebike_charging') &&
|
||||
!answer.pois.some((poi) => poi.category === 'ebike_charging');
|
||||
return (
|
||||
|
||||
@@ -768,5 +768,11 @@ describe('e-bike charging along a bike tour (BIK-07)', () => {
|
||||
fireEvent.click(screen.getByTestId('tour-poi-widen'));
|
||||
expect(await screen.findByText(/Could not be searched right now: E-bike charging/)).toBeInTheDocument();
|
||||
expect(screen.queryByTestId('tour-poi-charging-few')).not.toBeInTheDocument();
|
||||
|
||||
// A cut answer may have lost the chargers to the cut: its own note says so, not few mapped.
|
||||
search.mockResolvedValue({ ...ANSWER, truncated: true });
|
||||
fireEvent.click(screen.getByTestId('tour-poi-retry'));
|
||||
expect(await screen.findByText(/There are more places than shown/)).toBeInTheDocument();
|
||||
expect(screen.queryByTestId('tour-poi-charging-few')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user