feat(search-backend-module-es): test error handling
Co-authored-by: Emma Indal <emma.indahl@gmail.com> Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
+23
@@ -793,6 +793,29 @@ describe('ElasticSearchSearchEngine', () => {
|
||||
|
||||
elasticSearchQuerySpy.mockClear();
|
||||
});
|
||||
|
||||
it('should throws missing index error', async () => {
|
||||
jest.spyOn(clientWrapper, 'search').mockRejectedValue({
|
||||
meta: {
|
||||
body: {
|
||||
error: {
|
||||
type: 'index_not_found_exception',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await expect(
|
||||
async () =>
|
||||
await testSearchEngine.query({
|
||||
term: 'testTerm',
|
||||
types: ['unknown'],
|
||||
filters: {},
|
||||
}),
|
||||
).rejects.toThrow(
|
||||
'Missing index for unknown__search. This means there are no documents to search through',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('indexer', () => {
|
||||
|
||||
Reference in New Issue
Block a user