Skip to content

Commit 0131e71

Browse files
committed
fix mocks
1 parent 5690a71 commit 0131e71

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

x-pack/plugins/global_search/public/services/search_service.mock.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@
77
import { SearchServiceSetup, SearchServiceStart } from './search_service';
88
import { of } from 'rxjs';
99

10-
const createSetupMock = (): jest.Mocked<SearchServiceSetup> => {
11-
return {
10+
const createSetupMock = () => {
11+
const mock: jest.Mocked<SearchServiceSetup> = {
1212
registerResultProvider: jest.fn(),
1313
};
14+
15+
return mock;
1416
};
1517

16-
const createStartMock = (): jest.Mocked<SearchServiceStart> => {
17-
const mock = {
18+
const createStartMock = () => {
19+
const mock: jest.Mocked<SearchServiceStart> = {
1820
find: jest.fn(),
1921
getSearchableTypes: jest.fn(),
2022
};
2123
mock.find.mockReturnValue(of({ results: [] }));
22-
mock.getSearchableTypes.mockReturnValue(of([]));
24+
mock.getSearchableTypes.mockResolvedValue([]);
2325

2426
return mock;
2527
};

x-pack/plugins/global_search/server/services/search_service.mock.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@
77
import { SearchServiceSetup, SearchServiceStart } from './search_service';
88
import { of } from 'rxjs';
99

10-
const createSetupMock = (): jest.Mocked<SearchServiceSetup> => {
11-
return {
10+
const createSetupMock = () => {
11+
const mock: jest.Mocked<SearchServiceSetup> = {
1212
registerResultProvider: jest.fn(),
1313
};
14+
15+
return mock;
1416
};
1517

16-
const createStartMock = (): jest.Mocked<SearchServiceStart> => {
17-
const mock = {
18+
const createStartMock = () => {
19+
const mock: jest.Mocked<SearchServiceStart> = {
1820
find: jest.fn(),
1921
getSearchableTypes: jest.fn(),
2022
};
2123
mock.find.mockReturnValue(of({ results: [] }));
22-
mock.getSearchableTypes.mockReturnValue(of([]));
24+
mock.getSearchableTypes.mockResolvedValue([]);
2325

2426
return mock;
2527
};

x-pack/plugins/global_search_bar/public/components/search_bar.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import { of, BehaviorSubject } from 'rxjs';
1111
import { filter, map } from 'rxjs/operators';
1212
import { mountWithIntl } from '@kbn/test/jest';
1313
import { applicationServiceMock } from '../../../../../src/core/public/mocks';
14-
import { GlobalSearchBatchedResults, GlobalSearchResult } from '../../../global_search/public';
1514
import { globalSearchPluginMock } from '../../../global_search/public/mocks';
15+
import { GlobalSearchBatchedResults, GlobalSearchResult } from '../../../global_search/public';
1616
import { SearchBar } from './search_bar';
1717

1818
type Result = { id: string; type: string } | string;

0 commit comments

Comments
 (0)