diff --git a/libs/feature/search/src/lib/state/effects.spec.ts b/libs/feature/search/src/lib/state/effects.spec.ts index cce5831230..6ac2e6a211 100644 --- a/libs/feature/search/src/lib/state/effects.spec.ts +++ b/libs/feature/search/src/lib/state/effects.spec.ts @@ -444,6 +444,45 @@ describe('Effects', () => { }) ) }) + describe('when geometry is broken', () => { + beforeEach(() => { + effects['filterGeometry$'] = of({ + type: 'Polygon', + coordinates: [[]], + }) + effects = TestBed.inject(SearchEffects) + actions$ = of(new RequestMoreResults('main')) + }) + it('skips the geometry in the search', async () => { + await firstValueFrom(effects.loadResults$) + expect(repository.search).toHaveBeenCalledWith( + expect.not.objectContaining({ + filterGeometry: { type: 'Polygon', coordinates: [[]] }, + }) + ) + }) + }) + describe('when geometry is invalid', () => { + beforeEach(() => { + effects['filterGeometry$'] = of({ + type: 'Polygon', + coordinates: [ + [0, 1], + [0, 1], + ], + }) as any + effects = TestBed.inject(SearchEffects) + actions$ = of(new RequestMoreResults('main')) + }) + it('skips the geometry in the search', async () => { + await firstValueFrom(effects.loadResults$) + expect(repository.search).toHaveBeenCalledWith( + expect.not.objectContaining({ + filterGeometry: { type: 'Polygon', coordinates: [[]] }, + }) + ) + }) + }) }) describe('when useSpatialFilter is disabled', () => { beforeEach(() => { diff --git a/libs/feature/search/src/lib/state/effects.ts b/libs/feature/search/src/lib/state/effects.ts index 9fc1641b50..e649346dab 100644 --- a/libs/feature/search/src/lib/state/effects.ts +++ b/libs/feature/search/src/lib/state/effects.ts @@ -146,7 +146,7 @@ export class SearchEffects { map((geom) => [state, favorites, geom]), catchError((e) => { return of([state, favorites, null]) - }) // silently opt out of spatial filter if an error happens + }) ) }), switchMap(