Skip to content

Commit 6692783

Browse files
committed
Add test
1 parent 44dc980 commit 6692783

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/instant-meilisearch/src/adapter/search-response-adapter/__tests__/geo-adapter.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,29 @@ describe('Geopoint adapter', () => {
4949
expect(adaptedHits[1]._formatted._geoloc).toBeUndefined()
5050
expect(adaptedHits[1]._formatted._geo).toBeUndefined()
5151
})
52+
53+
test('hits with _geoloc field should have randomly generated `objectID` property', () => {
54+
const hits = [
55+
{
56+
id: 2,
57+
_geo: {
58+
lat: 1,
59+
lng: 2,
60+
},
61+
_formatted: {
62+
_geo: {
63+
lat: 1,
64+
lng: 2,
65+
},
66+
},
67+
},
68+
]
69+
70+
const adaptedHits = adaptGeoResponse(hits)
71+
72+
expect(adaptedHits[0]).toHaveProperty('_geoloc')
73+
expect(adaptedHits[0]).toHaveProperty('_geo')
74+
expect(adaptedHits[0]).toHaveProperty('objectID')
75+
expect(typeof adaptedHits[0].objectID === 'string').toBeTruthy()
76+
})
5277
})

0 commit comments

Comments
 (0)