Skip to content
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Usage:

### Finite Pagination

Finite pagination is used when you want to add a numbered pagination at the bottom of your hits (for example: `< << 1, 2, 3 > >>`).
Finite pagination is used when you want to add a numbered pagination at the bottom of your hits (for example: `<< < 1, 2, 3 > >>`).
To be able to know the amount of page numbers you have, a search is done requesting `paginationTotalHits` documents (default: `200`).
With the amount of documents returned, instantsearch is able to render the correct amount of numbers in the pagination widget.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ test('One field in cache present in distribution', () => {
{ genre: ['comedy'] },
{ genre: { comedy: 1 } }
)

expect(returnedDistribution).toMatchObject({ genre: { comedy: 1 } })
})

test('One field in cache not present in distribution', () => {
const returnedDistribution = addMissingFacets({ genre: ['comedy'] }, {})

expect(returnedDistribution).toMatchObject({ genre: { comedy: 0 } })
})

Expand All @@ -18,6 +20,7 @@ test('two field in cache only one present in distribution', () => {
{ genre: ['comedy'], title: ['hamlet'] },
{ genre: { comedy: 12 } }
)

expect(returnedDistribution).toMatchObject({
genre: { comedy: 12 },
title: { hamlet: 0 },
Expand All @@ -29,6 +32,7 @@ test('two field in cache w/ different facet name none present in distribution',
{ genre: ['comedy'], title: ['hamlet'] },
{}
)

expect(returnedDistribution).toMatchObject({
genre: { comedy: 0 },
title: { hamlet: 0 },
Expand All @@ -40,6 +44,7 @@ test('two field in cache w/ different facet name both present in distribution',
{ genre: ['comedy'], title: ['hamlet'] },
{ genre: { comedy: 12 }, title: { hamlet: 1 } }
)

expect(returnedDistribution).toMatchObject({
genre: { comedy: 12 },
title: { hamlet: 1 },
Expand All @@ -51,6 +56,7 @@ test('Three field in cache w/ different facet name two present in distribution',
{ genre: ['comedy', 'horror'], title: ['hamlet'] },
{ genre: { comedy: 12 }, title: { hamlet: 1 } }
)

expect(returnedDistribution).toMatchObject({
genre: { comedy: 12, horror: 0 },
title: { hamlet: 1 },
Expand All @@ -61,25 +67,30 @@ test('Cache is undefined and facets distribution is not', () => {
const returnedDistribution = addMissingFacets(undefined, {
genre: { comedy: 12 },
})

expect(returnedDistribution).toMatchObject({ genre: { comedy: 12 } })
})

test('Cache is empty object and facets distribution is not', () => {
const returnedDistribution = addMissingFacets({}, { genre: { comedy: 12 } })

expect(returnedDistribution).toMatchObject({ genre: { comedy: 12 } })
})

test('Cache is empty object and facets distribution empty object', () => {
const returnedDistribution = addMissingFacets({}, {})

expect(returnedDistribution).toMatchObject({})
})

test('Cache is undefined and facets distribution empty object', () => {
const returnedDistribution = addMissingFacets(undefined, {})

expect(returnedDistribution).toMatchObject({})
})

test('Cache is undefined and facets distribution is undefined', () => {
const returnedDistribution = addMissingFacets(undefined, undefined)

expect(returnedDistribution).toMatchObject({})
})
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ describe.each(facetCacheData)(
{ keepZeroFacets: false, defaultFacetDistribution: {} },
{ filter: filters }
)

expect(cache).toEqual(expectedCache)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@ test('Adapt geoPoints rules with integer geo points', () => {
const rules = adaptGeoPointsRules({
insideBoundingBox: '1,2,3,4',
})

expect(rules?.filter).toBe('_geoRadius(3.17650, 3.19394, 157201.47551181243)')
})

test('Try geoContext with only a radius', () => {
const rules = adaptGeoPointsRules({
aroundRadius: 1,
})

expect(rules).toBeUndefined()
})

test('Try geoContext with an aroundLatLng', () => {
const rules = adaptGeoPointsRules({
aroundLatLng: '51.1241999, 9.662499900000057',
})

expect(rules?.filter).toBeUndefined()
})

Expand All @@ -39,6 +42,7 @@ test('Try geoContext with an aroundLatLng and a radius', () => {
aroundLatLng: '51.1241999, 9.662499900000057',
aroundRadius: 1,
})

expect(rules?.filter).toBe('_geoRadius(51.12420, 9.66250, 1)')
})

Expand All @@ -47,6 +51,7 @@ test('Try geoContext with an aroundLatLng and a 0 radius', () => {
aroundLatLng: '51.1241999, 9.662499900000057',
aroundRadius: 0,
})

expect(rules?.filter).toBe('_geoRadius(51.12420, 9.66250, 0)')
})

Expand All @@ -56,19 +61,22 @@ test('Try geoContext with aroundLatLng, radius and insideBoundingBox', () => {
aroundRadius: 1,
insideBoundingBox: '1,2,3,4',
})

expect(rules?.filter).toBe('_geoRadius(3.17650, 3.19394, 157201.47551181243)')
})
test('Try geoContext with a radius and insideBoundingBox', () => {
const rules = adaptGeoPointsRules({
aroundRadius: 1,
insideBoundingBox: '1,2,3,4',
})

expect(rules?.filter).toBe('_geoRadius(3.17650, 3.19394, 157201.47551181243)')
})
test('Try geoContext with aroundLatLng and insideBoundingBox', () => {
const rules = adaptGeoPointsRules({
aroundLatLng: '51.1241999, 9.662499900000057',
insideBoundingBox: '1,2,3,4',
})

expect(rules?.filter).toBe('_geoRadius(3.17650, 3.19394, 157201.47551181243)')
})
Loading