Skip to content

Commit

Permalink
fix mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Dec 8, 2020
1 parent 5690a71 commit 0131e71
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@
import { SearchServiceSetup, SearchServiceStart } from './search_service';
import { of } from 'rxjs';

const createSetupMock = (): jest.Mocked<SearchServiceSetup> => {
return {
const createSetupMock = () => {
const mock: jest.Mocked<SearchServiceSetup> = {
registerResultProvider: jest.fn(),
};

return mock;
};

const createStartMock = (): jest.Mocked<SearchServiceStart> => {
const mock = {
const createStartMock = () => {
const mock: jest.Mocked<SearchServiceStart> = {
find: jest.fn(),
getSearchableTypes: jest.fn(),
};
mock.find.mockReturnValue(of({ results: [] }));
mock.getSearchableTypes.mockReturnValue(of([]));
mock.getSearchableTypes.mockResolvedValue([]);

return mock;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@
import { SearchServiceSetup, SearchServiceStart } from './search_service';
import { of } from 'rxjs';

const createSetupMock = (): jest.Mocked<SearchServiceSetup> => {
return {
const createSetupMock = () => {
const mock: jest.Mocked<SearchServiceSetup> = {
registerResultProvider: jest.fn(),
};

return mock;
};

const createStartMock = (): jest.Mocked<SearchServiceStart> => {
const mock = {
const createStartMock = () => {
const mock: jest.Mocked<SearchServiceStart> = {
find: jest.fn(),
getSearchableTypes: jest.fn(),
};
mock.find.mockReturnValue(of({ results: [] }));
mock.getSearchableTypes.mockReturnValue(of([]));
mock.getSearchableTypes.mockResolvedValue([]);

return mock;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { of, BehaviorSubject } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { mountWithIntl } from '@kbn/test/jest';
import { applicationServiceMock } from '../../../../../src/core/public/mocks';
import { GlobalSearchBatchedResults, GlobalSearchResult } from '../../../global_search/public';
import { globalSearchPluginMock } from '../../../global_search/public/mocks';
import { GlobalSearchBatchedResults, GlobalSearchResult } from '../../../global_search/public';
import { SearchBar } from './search_bar';

type Result = { id: string; type: string } | string;
Expand Down

0 comments on commit 0131e71

Please sign in to comment.