Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Oct 5, 2022
1 parent bed8cc2 commit ee8a32a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ export function ChangeDataView({
</EuiButton>
);
};
dataViewEditor.userPermissions.editDataView();

const getPanelItems = () => {
const panelItems: EuiContextMenuPanelProps['items'] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React from 'react';
import SearchBar from './search_bar';

import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { indexPatternEditorPluginMock as dataViewEditorPluginMock } from '@kbn/data-view-editor-plugin/public/mocks';
import { I18nProvider } from '@kbn/i18n-react';

import { coreMock } from '@kbn/core/public/mocks';
Expand Down Expand Up @@ -83,6 +84,9 @@ function wrapSearchBarInContext(testProps: any) {
intl: null as any,
};

const dataViewEditorMock = dataViewEditorPluginMock.createStartContract();
(dataViewEditorMock.userPermissions.editDataView as jest.Mock).mockReturnValue(true);

const services = {
uiSettings: startMock.uiSettings,
savedObjects: startMock.savedObjects,
Expand Down Expand Up @@ -111,6 +115,7 @@ function wrapSearchBarInContext(testProps: any) {
}),
},
},
dataViewEditor: dataViewEditorMock,
dataViews: {
getIdsWithTitle: jest.fn(() => []),
},
Expand Down

0 comments on commit ee8a32a

Please sign in to comment.