Fmt
This commit is contained in:
parent
63713c3a2b
commit
bd6b511f16
17 changed files with 544 additions and 377 deletions
|
|
@ -27,7 +27,10 @@ describe('poi-distance-filter', () => {
|
|||
|
||||
expect(
|
||||
getPoiFilterFeatureOptions(features, POI_DISTANCE_FILTER_NAME).map((f) => f.name)
|
||||
).toEqual(['Distance to nearest amenity (Cafe) (km)', 'Distance to nearest amenity (Park) (km)']);
|
||||
).toEqual([
|
||||
'Distance to nearest amenity (Cafe) (km)',
|
||||
'Distance to nearest amenity (Park) (km)',
|
||||
]);
|
||||
expect(
|
||||
getPoiFilterFeatureOptions(features, TRANSPORT_DISTANCE_FILTER_NAME).map((f) => f.name)
|
||||
).toEqual([
|
||||
|
|
@ -54,11 +57,4 @@ describe('poi-distance-filter', () => {
|
|||
);
|
||||
expect(getPoiFilterName('Number of amenities (Bus stop) within 2km')).toBeNull();
|
||||
});
|
||||
|
||||
it('recognizes the old static park distance name for URL migration only', () => {
|
||||
expect(getPoiFilterName('Distance to nearest park (km)')).toBe(POI_DISTANCE_FILTER_NAME);
|
||||
expect(
|
||||
getPoiFilterFeatureOptions([numeric('Distance to nearest park (km)')], POI_DISTANCE_FILTER_NAME)
|
||||
).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -225,14 +225,14 @@ describe('url-state', () => {
|
|||
});
|
||||
|
||||
it('round-trips repeated amenity distance filters with dedicated URL params', () => {
|
||||
const park = createPoiDistanceFilterKey('Distance to nearest park (km)', 3);
|
||||
const grocery = createPoiDistanceFilterKey('Distance to nearest grocery store (km)', 4);
|
||||
const park = createPoiDistanceFilterKey('Distance to nearest amenity (Park) (km)', 3);
|
||||
const cafe = createPoiDistanceFilterKey('Distance to nearest amenity (Café) (km)', 4);
|
||||
|
||||
const params = stateToParams(
|
||||
null,
|
||||
{
|
||||
[park]: [0, 0.4],
|
||||
[grocery]: [0, 1.5],
|
||||
[cafe]: [0, 1.5],
|
||||
},
|
||||
[],
|
||||
new Set(),
|
||||
|
|
@ -240,8 +240,8 @@ describe('url-state', () => {
|
|||
);
|
||||
|
||||
expect(params.getAll('amenityDistance')).toEqual([
|
||||
'Distance%20to%20nearest%20park%20(km):0:0.4',
|
||||
'Distance%20to%20nearest%20grocery%20store%20(km):0:1.5',
|
||||
'Distance%20to%20nearest%20amenity%20(Park)%20(km):0:0.4',
|
||||
'Distance%20to%20nearest%20amenity%20(Caf%C3%A9)%20(km):0:1.5',
|
||||
]);
|
||||
expect(params.getAll('filter')).toEqual([]);
|
||||
|
||||
|
|
@ -249,8 +249,8 @@ describe('url-state', () => {
|
|||
const state = parseUrlState();
|
||||
|
||||
expect(state.filters).toEqual({
|
||||
[createPoiDistanceFilterKey('Distance to nearest park (km)', 0)]: [0, 0.4],
|
||||
[createPoiDistanceFilterKey('Distance to nearest grocery store (km)', 1)]: [0, 1.5],
|
||||
[createPoiDistanceFilterKey('Distance to nearest amenity (Park) (km)', 0)]: [0, 0.4],
|
||||
[createPoiDistanceFilterKey('Distance to nearest amenity (Café) (km)', 1)]: [0, 1.5],
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -289,24 +289,6 @@ describe('url-state', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('migrates legacy transport distance amenity params into transport filters', () => {
|
||||
window.history.replaceState(
|
||||
{},
|
||||
'',
|
||||
'/?amenityDistance=Distance%20to%20nearest%20amenity%20(Bus%20stop)%20(km):0:0.3'
|
||||
);
|
||||
|
||||
const state = parseUrlState();
|
||||
|
||||
expect(state.filters).toEqual({
|
||||
[createPoiFilterKey(
|
||||
TRANSPORT_DISTANCE_FILTER_NAME,
|
||||
'Distance to nearest amenity (Bus stop) (km)',
|
||||
0
|
||||
)]: [0, 0.3],
|
||||
});
|
||||
});
|
||||
|
||||
it('round-trips amenity count filters with dedicated URL params', () => {
|
||||
const cafes = createPoiFilterKey(
|
||||
POI_COUNT_2KM_FILTER_NAME,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue