Skip to content

Commit

Permalink
test: Migrate place-input.spec.js
Browse files Browse the repository at this point in the history
- TODO: test emits properly
- add fixtures for geocode search & reverse
- issue #322
  skip 'no suggestions on cleared input' until suggestions cleared
  with previous coordinate input as well
- remove old spec
  • Loading branch information
TheGreatRefrigerator committed Jan 26, 2023
1 parent 2992821 commit dca867b
Show file tree
Hide file tree
Showing 4 changed files with 507 additions and 122 deletions.
285 changes: 285 additions & 0 deletions cypress/fixtures/geocode_mock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
{
"geocoding": {
"version": "0.2",
"attribution": "https://openrouteservice.org/terms-of-service/#attribution-geocode",
"query": {
"text": "heidelberg",
"size": 10,
"layers": ["venue"],
"private": false,
"focus.point.lat": 49.32107,
"focus.point.lon": 8.820839,
"boundary.rect.min_lat": 49.420800745197006,
"boundary.rect.max_lat": 49.49856986704614,
"boundary.rect.min_lon": 8.558778762817385,
"boundary.rect.max_lon": 8.627443313598635,
"lang": {
"name": "English",
"iso6391": "en",
"iso6393": "eng",
"via": "header",
"defaulted": false
},
"querySize": 20,
"parser": "pelias",
"parsed_text": {
"subject": "heidelberg",
"locality": "heidelberg"
}
},
"engine": {
"name": "Pelias",
"author": "Mapzen",
"version": "1.0"
},
"timestamp": 1674480778092
},
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [8.597191, 49.422737]
},
"properties": {
"id": "way/30767075",
"gid": "openstreetmap:venue:way/30767075",
"layer": "venue",
"source": "openstreetmap",
"source_id": "way/30767075",
"name": "Friedhof Heidelberg-Grenzhof",
"confidence": 1,
"match_type": "exact",
"distance": 19.771,
"accuracy": "point",
"country": "Germany",
"country_gid": "whosonfirst:country:85633111",
"country_a": "DEU",
"region": "Baden-Württemberg",
"region_gid": "whosonfirst:region:85682567",
"region_a": "BW",
"macrocounty": "Karlsruhe Government Region",
"macrocounty_gid": "whosonfirst:macrocounty:404227555",
"county": "Rhein-Neckar-Kreis",
"county_gid": "whosonfirst:county:102063481",
"county_a": "RN",
"localadmin": "Neckargemünd",
"localadmin_gid": "whosonfirst:localadmin:1377688757",
"locality": "Heidelberg",
"locality_gid": "whosonfirst:locality:101906011",
"continent": "Europe",
"continent_gid": "whosonfirst:continent:102191581",
"label": "Friedhof Heidelberg-Grenzhof, Heidelberg, BW, Germany",
"addendum": {
"osm": {
"operator": "Stadt Heidelberg",
"website": "http://grabsteine.genealogy.net/namelist.php?cem=6375"
}
}
},
"bbox": [8.5969538, 49.4225255, 8.5974449, 49.4229529]
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [8.603741, 49.445785]
},
"properties": {
"id": "node/8024659050",
"gid": "openstreetmap:venue:node/8024659050",
"layer": "venue",
"source": "openstreetmap",
"source_id": "node/8024659050",
"name": "Sushi Palace Heidelberg",
"housenumber": "4",
"street": "Amselweg",
"postalcode": "68535",
"confidence": 1,
"match_type": "exact",
"distance": 20.982,
"accuracy": "point",
"country": "Germany",
"country_gid": "whosonfirst:country:85633111",
"country_a": "DEU",
"region": "Baden-Württemberg",
"region_gid": "whosonfirst:region:85682567",
"region_a": "BW",
"macrocounty": "Karlsruhe Government Region",
"macrocounty_gid": "whosonfirst:macrocounty:404227555",
"county": "Rhein-Neckar-Kreis",
"county_gid": "whosonfirst:county:102063481",
"county_a": "RN",
"localadmin": "Edingen-Neckarhausen",
"localadmin_gid": "whosonfirst:localadmin:1377688705",
"locality": "Edingen-Neckarhausen",
"locality_gid": "whosonfirst:locality:101840827",
"continent": "Europe",
"continent_gid": "whosonfirst:continent:102191581",
"label": "Sushi Palace Heidelberg, Edingen-Neckarhausen, BW, Germany",
"addendum": {
"osm": {
"wheelchair": "yes",
"opening_hours": "Tu-Fr 16:00-22:00; Sa 16:00-22:00; Su 12:00-22:00"
}
}
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [8.561445, 49.450945]
},
"properties": {
"id": "node/8904884901",
"gid": "openstreetmap:venue:node/8904884901",
"layer": "venue",
"source": "openstreetmap",
"source_id": "node/8904884901",
"name": "cyber-Wear Heidelberg GmbH",
"confidence": 1,
"match_type": "exact",
"distance": 23.714,
"accuracy": "point",
"country": "Germany",
"country_gid": "whosonfirst:country:85633111",
"country_a": "DEU",
"region": "Baden-Württemberg",
"region_gid": "whosonfirst:region:85682567",
"region_a": "BW",
"macrocounty": "Karlsruhe Government Region",
"macrocounty_gid": "whosonfirst:macrocounty:404227555",
"county": "Mannheim",
"county_gid": "whosonfirst:county:102063473",
"county_a": "MN",
"localadmin": "Mannheim",
"localadmin_gid": "whosonfirst:localadmin:1377688443",
"locality": "Mannheim",
"locality_gid": "whosonfirst:locality:101748549",
"continent": "Europe",
"continent_gid": "whosonfirst:continent:102191581",
"label": "cyber-Wear Heidelberg GmbH, Mannheim, BW, Germany"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [8.625239, 49.437238]
},
"properties": {
"id": "way/95781906",
"gid": "openstreetmap:venue:way/95781906",
"layer": "venue",
"source": "openstreetmap",
"source_id": "way/95781906",
"name": "Schützengesellschaft 1925 Heidelberg-Wieblingen e.V",
"confidence": 1,
"match_type": "exact",
"distance": 19.188,
"accuracy": "point",
"country": "Germany",
"country_gid": "whosonfirst:country:85633111",
"country_a": "DEU",
"region": "Baden-Württemberg",
"region_gid": "whosonfirst:region:85682567",
"region_a": "BW",
"macrocounty": "Karlsruhe Government Region",
"macrocounty_gid": "whosonfirst:macrocounty:404227555",
"county": "Rhein-Neckar-Kreis",
"county_gid": "whosonfirst:county:102063481",
"county_a": "RN",
"localadmin": "Neckargemünd",
"localadmin_gid": "whosonfirst:localadmin:1377688757",
"locality": "Heidelberg",
"locality_gid": "whosonfirst:locality:101906011",
"continent": "Europe",
"continent_gid": "whosonfirst:continent:102191581",
"label": "Schützengesellschaft 1925 Heidelberg-Wieblingen e.V, Heidelberg, BW, Germany"
},
"bbox": [8.6249428, 49.4370923, 8.6254682, 49.4373744]
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [8.599966, 49.448967]
},
"properties": {
"id": "node/6452015839",
"gid": "openstreetmap:venue:node/6452015839",
"layer": "venue",
"source": "openstreetmap",
"source_id": "node/6452015839",
"name": "Geschichte der schmalspurigen Eisenbahn von Mannheim nach Heidelberg",
"confidence": 1,
"match_type": "exact",
"distance": 21.422,
"accuracy": "point",
"country": "Germany",
"country_gid": "whosonfirst:country:85633111",
"country_a": "DEU",
"region": "Baden-Württemberg",
"region_gid": "whosonfirst:region:85682567",
"region_a": "BW",
"macrocounty": "Karlsruhe Government Region",
"macrocounty_gid": "whosonfirst:macrocounty:404227555",
"county": "Rhein-Neckar-Kreis",
"county_gid": "whosonfirst:county:102063481",
"county_a": "RN",
"localadmin": "Edingen-Neckarhausen",
"localadmin_gid": "whosonfirst:localadmin:1377688705",
"locality": "Edingen-Neckarhausen",
"locality_gid": "whosonfirst:locality:101840827",
"continent": "Europe",
"continent_gid": "whosonfirst:continent:102191581",
"label": "Geschichte der schmalspurigen Eisenbahn von Mannheim nach Heidelberg, Edingen-Neckarhausen, BW, Germany"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [8.584696, 49.451391]
},
"properties": {
"id": "node/1836187021",
"gid": "openstreetmap:venue:node/1836187021",
"layer": "venue",
"source": "openstreetmap",
"source_id": "node/1836187021",
"name": "Heidelberger Depot Gastronomiebedarf",
"confidence": 1,
"match_type": "exact",
"distance": 22.434,
"accuracy": "point",
"country": "Germany",
"country_gid": "whosonfirst:country:85633111",
"country_a": "DEU",
"region": "Baden-Württemberg",
"region_gid": "whosonfirst:region:85682567",
"region_a": "BW",
"macrocounty": "Karlsruhe Government Region",
"macrocounty_gid": "whosonfirst:macrocounty:404227555",
"county": "Rhein-Neckar-Kreis",
"county_gid": "whosonfirst:county:102063481",
"county_a": "RN",
"localadmin": "Edingen-Neckarhausen",
"localadmin_gid": "whosonfirst:localadmin:1377688705",
"locality": "Edingen-Neckarhausen",
"locality_gid": "whosonfirst:locality:101840827",
"continent": "Europe",
"continent_gid": "whosonfirst:continent:102191581",
"label": "Heidelberger Depot Gastronomiebedarf, Edingen-Neckarhausen, BW, Germany",
"addendum": {
"osm": {
"website": "http://www.heidelberger-depot.de/"
}
}
}
}
],
"bbox": [8.561445, 49.4225255, 8.6254682, 49.451391]
}
84 changes: 84 additions & 0 deletions cypress/fixtures/geocode_reverse_mock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"geocoding": {
"version": "0.2",
"attribution": "https://openrouteservice.org/terms-of-service/#attribution-geocode",
"query": {
"size": 10,
"private": false,
"point.lat": 8.611907958984377,
"point.lon": 49.46098385110948,
"boundary.circle.lat": 8.611907958984377,
"boundary.circle.lon": 49.46098385110948,
"lang": {
"name": "English",
"iso6391": "en",
"iso6393": "eng",
"via": "header",
"defaulted": false
},
"querySize": 20
},
"engine": {
"name": "Pelias",
"author": "Mapzen",
"version": "1.0"
},
"timestamp": 1674480984059
},
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [8.769869, 49.37625]
},
"properties": {
"layer": "locality",
"name": "Heidelberg",
"distance": 0.867,
"country_a": "DEU",
"locality": "Heidelberg",
"label": "Heidelberg, BW, Germany"
},
"bbox": [8.57312513958, 49.3521596612, 8.79412886129, 49.4595876777],
"distance": 0.8655641929890087
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [8.793137, 49.39434]
},
"properties": {
"layer": "venue",
"source": "openstreetmap",
"name": "Sparkasse Heidelberg",
"distance": 2.585,
"country_a": "DEU",
"locality": "Neckargemünd",
"label": "Sparkasse Heidelberg, Neckargemünd, BW, Germany"
},
"bbox": [8.7928299, 49.3941569, 8.7933164, 49.3943459],
"distance": 2.58199841383592
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [8.692416, 49.401247]
},
"properties": {
"layer": "county",
"name": "Heidelberg",
"distance": 5.497,
"country_a": "DEU",
"county": "Heidelberg",
"label": "Heidelberg, BW, Germany"
},
"bbox": [8.573125, 49.35216, 8.794129, 49.459588],
"distance": 5.490898644881834
}
],
"bbox": [49.039135, 8.337058, 50.090204, 10.559783]
}
Loading

0 comments on commit dca867b

Please sign in to comment.