mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
test(maps): pin the coordinates a suggestion carries
The half of the change that saves the pick from a text search for its own label was covered by nothing. MAPS-AUTO-010 reads `source` and stops there; the client test writes the coordinates into its own mock and then asserts them. Delete `lat: p.lat, lng: p.lng` from the service and both stay green, while the fallback quietly goes back to searching for "Tokio Hauptbahnhof, 東京駅丸の内駅舎" and taking whatever comes back first. So the server test now asserts the coordinates on the wire for both indexes, and the mobile sheet — which carries a copy of the same fallback and had no test for it at all — gets one for the fallback and one for the source mark.
This commit is contained in:
@@ -209,6 +209,18 @@ describe('MapsService.autocompletePlaces', () => {
|
||||
expect(suggestions.map(s => s.source)).toEqual(['trek-places', 'openstreetmap']);
|
||||
});
|
||||
|
||||
it('MAPS-AUTO-011: a suggestion carries the coordinates the index already gave, so the pick needs no second hop', async () => {
|
||||
mockSearch.mockResolvedValue([hit(), osmHit()]);
|
||||
|
||||
const { suggestions } = await make().autocompletePlaces(1, INPUT);
|
||||
|
||||
// Without these the client, when the details lookup cannot answer, searches
|
||||
// for the label instead — and for a layer row that label is a name plus its
|
||||
// local spelling, which is not a query anybody typed.
|
||||
expect(suggestions[0]).toMatchObject({ lat: 54.0879, lng: 12.1408 });
|
||||
expect(suggestions[1]).toMatchObject({ lat: 35.6811816, lng: 139.76598265 });
|
||||
});
|
||||
|
||||
it('MAPS-AUTO-007: the keystroke never leaves for the index while the admin has it off', async () => {
|
||||
mockSearch.mockResolvedValue([hit()]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user