mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
Switch location bias from a point to a bounding box for improved autocomplete accuracy and validation.
This commit is contained in:
@@ -314,7 +314,7 @@ describe('Maps autocomplete', () => {
|
||||
const res = await request(app)
|
||||
.post('/api/maps/autocomplete')
|
||||
.set('Cookie', authCookie(user.id))
|
||||
.send({ input: 'Paris', locationBias: { lat: NaN, lng: 2.3 } });
|
||||
.send({ input: 'Paris', locationBias: { low: { lat: NaN, lng: 2.3 }, high: { lat: 49, lng: 3 } } });
|
||||
expect(res.status).toBe(400);
|
||||
});
|
||||
|
||||
@@ -348,13 +348,13 @@ describe('Maps autocomplete', () => {
|
||||
await request(app)
|
||||
.post('/api/maps/autocomplete')
|
||||
.set('Cookie', authCookie(user.id))
|
||||
.send({ input: 'test', lang: 'fr', locationBias: { lat: 48.8, lng: 2.3 } });
|
||||
.send({ input: 'test', lang: 'fr', locationBias: { low: { lat: 48.5, lng: 2.0 }, high: { lat: 49.0, lng: 2.8 } } });
|
||||
|
||||
expect(mapsService.autocompletePlaces).toHaveBeenCalledWith(
|
||||
user.id,
|
||||
'test',
|
||||
'fr',
|
||||
{ lat: 48.8, lng: 2.3 },
|
||||
{ low: { lat: 48.5, lng: 2.0 }, high: { lat: 49.0, lng: 2.8 } },
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user