Skip to content

Commit

Permalink
[TIP] Fix failing QueryBar test suite (elastic#137834) (elastic#137851)
Browse files Browse the repository at this point in the history
(cherry picked from commit e6ecf81)

Co-authored-by: Luke Gmys <[email protected]>
  • Loading branch information
kibanamachine and lgmys authored Aug 2, 2022
1 parent 8b1aae6 commit c6a97f0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export const createTiStorageMock = () => {

const data = dataPluginMock.createStartContract();
const { storage } = createTiStorageMock();
const unifiedSearch = unifiedSearchPluginMock.createStartContract();

export const unifiedSearch = unifiedSearchPluginMock.createStartContract();

const dataServiceMock = {
...data,
Expand Down Expand Up @@ -100,18 +101,16 @@ const mockSecurityContext: ThreatIntelligenceSecuritySolutionContext = {

mockCoreStart.uiSettings.get.mockImplementation(mockUiSetting);

const mockedServices = {
...mockCoreStart,
data: dataServiceMock,
storage,
unifiedSearch,
} as unknown as Services;

export const TestProvidersComponent: FC = ({ children }) => (
<SecuritySolutionContext.Provider value={mockSecurityContext}>
<KibanaContextProvider
services={
{
...mockCoreStart,
data: dataServiceMock,
storage,
unifiedSearch,
} as unknown as Services
}
>
<KibanaContextProvider services={mockedServices}>
<I18nProvider>{children}</I18nProvider>
</KibanaContextProvider>
</SecuritySolutionContext.Provider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@ import userEvent from '@testing-library/user-event';
import { FilterManager } from '@kbn/data-plugin/public';

import { coreMock } from '@kbn/core/public/mocks';
import { TestProvidersComponent } from '../../../../common/mocks/test_providers';
import { TestProvidersComponent, unifiedSearch } from '../../../../common/mocks/test_providers';
import { getByTestSubj } from '../../../../../common/test/utils';
import { setAutocomplete } from '@kbn/unified-search-plugin/public/services';

const mockUiSettingsForFilterManager = coreMock.createStart().uiSettings;

const filterManager = new FilterManager(mockUiSettingsForFilterManager);

// Failing: See https://github.com/elastic/kibana/issues/137752
describe.skip('QueryBar ', () => {
describe('QueryBar ', () => {
const onSubmitQuery = jest.fn();
const onSubmitDateRange = jest.fn();
const onSavedQuery = jest.fn();
const onChangedQuery = jest.fn();

beforeEach(() => {
setAutocomplete(unifiedSearch.autocomplete);
});

beforeEach(async () => {
await act(async () => {
render(
Expand Down

0 comments on commit c6a97f0

Please sign in to comment.