[AppServices] Fix unhandled promise rejections in search tests (#112849)
* updated jest tests to avoid generating unhandled promise rejections * rather use throwError * remove unused imports Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
47c9efded8
commit
7a49851bc3
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { of } from 'rxjs';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { IndexPattern } from '../..';
|
||||
import { SearchSource, SearchSourceDependencies, SortDirection } from './';
|
||||
import { AggConfigs, AggTypesRegistryStart } from '../../';
|
||||
|
@ -1113,7 +1113,7 @@ describe('SearchSource', () => {
|
|||
},
|
||||
};
|
||||
|
||||
searchSourceDependencies.search = jest.fn().mockReturnValue(of(Promise.reject('aaaaa')));
|
||||
searchSourceDependencies.search = jest.fn().mockReturnValue(throwError('aaaaa'));
|
||||
|
||||
searchSource = new SearchSource({}, searchSourceDependencies);
|
||||
searchSource.setField('index', indexPattern);
|
||||
|
|
|
@ -38,10 +38,8 @@ describe('Search service', () => {
|
|||
let mockCoreStart: MockedKeys<CoreStart>;
|
||||
|
||||
beforeEach(() => {
|
||||
const mockLogger: any = {
|
||||
debug: () => {},
|
||||
};
|
||||
const context = coreMock.createPluginInitializerContext({});
|
||||
const mockLogger = context.logger.get();
|
||||
context.config.create = jest.fn().mockImplementation(() => {
|
||||
return of({
|
||||
search: {
|
||||
|
|
Loading…
Reference in a new issue