[Enterprise Search] Miscellaneous test cleanups (#88525)

* Update older tests mocking useValues to setMockValues

* Update older logic tests to use newer LogicMounter helper

- NOTE: shared logic files are still using resetContext however, in order to not accidentally override/mock kea + since they should be testing their own mount helpers

* Merge/DRY kea.mock helpers into a single import

* Remove unnecessary kea.mock file imports

- the automock already happens when you import something from the kea.mock file
- in some cases in WS the mock just wasn't needed

* Newline linting

- Do I need a hobby? yes
- Is this my hobby? ...maybe

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Constance 2021-01-19 07:49:10 -08:00 committed by GitHub
parent fbf600d7fc
commit eb4cb3d1dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 46 additions and 131 deletions

View file

@ -4,15 +4,16 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { resetContext } from 'kea'; import { LogicMounter } from '../__mocks__';
import { DEFAULT_INITIAL_APP_DATA } from '../../../common/__mocks__'; import { DEFAULT_INITIAL_APP_DATA } from '../../../common/__mocks__';
import { AppLogic } from './app_logic'; import { AppLogic } from './app_logic';
describe('AppLogic', () => { describe('AppLogic', () => {
const { mount } = new LogicMounter(AppLogic);
beforeEach(() => { beforeEach(() => {
resetContext({}); mount();
AppLogic.mount();
}); });
const DEFAULT_VALUES = { const DEFAULT_VALUES = {

View file

@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { setMockValues, setMockActions } from '../../../../../__mocks__/kea.mock'; import { setMockValues, setMockActions, rerender } from '../../../../../__mocks__';
import { rerender } from '../../../../../__mocks__';
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';

View file

@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock'; import { setMockValues, setMockActions, rerender } from '../../../../__mocks__';
import { rerender } from '../../../../__mocks__';
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';

View file

@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock'; import { setMockValues, setMockActions, rerender } from '../../../../__mocks__';
import { rerender } from '../../../../__mocks__';
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';

View file

@ -3,8 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License; * or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { setMockValues, setMockActions } from '../../../__mocks__/kea.mock';
import '../../../__mocks__/react_router_history.mock'; import '../../../__mocks__/react_router_history.mock';
import { setMockValues, setMockActions } from '../../../__mocks__/kea.mock';
import { unmountHandler } from '../../../__mocks__/shallow_useeffect.mock'; import { unmountHandler } from '../../../__mocks__/shallow_useeffect.mock';
import React from 'react'; import React from 'react';

View file

@ -3,6 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License; * or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { setMockValues } from '../../../__mocks__/kea.mock'; import { setMockValues } from '../../../__mocks__/kea.mock';
import React from 'react'; import React from 'react';

View file

@ -3,9 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License; * or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockValues } from '../../../../__mocks__';
import '../../../../__mocks__/enterprise_search_url.mock'; import '../../../../__mocks__/enterprise_search_url.mock';
import { setMockValues } from '../../../../__mocks__';
const mockSetFields = jest.fn(); const mockSetFields = jest.fn();

View file

@ -3,6 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License; * or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';

View file

@ -3,6 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License; * or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';

View file

@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { setMockValues } from '../../../__mocks__/kea.mock'; import { setMockValues, rerender } from '../../../__mocks__';
import { rerender } from '../../../__mocks__';
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';

View file

@ -5,8 +5,7 @@
*/ */
import '../../../__mocks__/shallow_useeffect.mock'; import '../../../__mocks__/shallow_useeffect.mock';
import { rerender } from '../../../__mocks__'; import { setMockValues, setMockActions, rerender } from '../../../__mocks__';
import { setMockValues, setMockActions } from '../../../__mocks__/kea.mock';
import React from 'react'; import React from 'react';
import { shallow, ShallowWrapper } from 'enzyme'; import { shallow, ShallowWrapper } from 'enzyme';

View file

@ -5,7 +5,6 @@
*/ */
import React from 'react'; import React from 'react';
import { shallow, ShallowWrapper } from 'enzyme'; import { shallow, ShallowWrapper } from 'enzyme';
import { EuiPanel } from '@elastic/eui'; import { EuiPanel } from '@elastic/eui';

View file

@ -5,7 +5,6 @@
*/ */
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { ResultField } from './result_field'; import { ResultField } from './result_field';

View file

@ -5,7 +5,6 @@
*/ */
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { ResultHeader } from './result_header'; import { ResultHeader } from './result_header';

View file

@ -5,7 +5,6 @@
*/ */
import React from 'react'; import React from 'react';
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import { ResultHeaderItem } from './result_header_item'; import { ResultHeaderItem } from './result_header_item';

View file

@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockActions, setMockValues } from '../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import '../../../../__mocks__/shallow_useeffect.mock'; import '../../../../__mocks__/shallow_useeffect.mock';
import { setMockActions, setMockValues } from '../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -3,6 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License; * or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { EuiPageContentBody } from '@elastic/eui'; import { EuiPageContentBody } from '@elastic/eui';

View file

@ -5,7 +5,6 @@
*/ */
import '../__mocks__/shallow_useeffect.mock'; import '../__mocks__/shallow_useeffect.mock';
import '../__mocks__/kea.mock';
import '../__mocks__/enterprise_search_url.mock'; import '../__mocks__/enterprise_search_url.mock';
import { setMockValues, setMockActions } from '../__mocks__'; import { setMockValues, setMockActions } from '../__mocks__';

View file

@ -4,11 +4,9 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../__mocks__/kea.mock'; import { setMockValues, mockTelemetryActions } from '../../../__mocks__';
import { mockTelemetryActions } from '../../../__mocks__';
import React from 'react'; import React from 'react';
import { useValues } from 'kea';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { EuiCard } from '@elastic/eui'; import { EuiCard } from '@elastic/eui';
@ -59,7 +57,7 @@ describe('ProductCard', () => {
}); });
it('renders correct button text when host not present', () => { it('renders correct button text when host not present', () => {
(useValues as jest.Mock).mockImplementation(() => ({ config: { host: '' } })); setMockValues({ config: { host: '' } });
const wrapper = shallow(<ProductCard product={WORKPLACE_SEARCH_PLUGIN} image="ws.jpg" />); const wrapper = shallow(<ProductCard product={WORKPLACE_SEARCH_PLUGIN} image="ws.jpg" />);
const card = wrapper.find(EuiCard).dive().shallow(); const card = wrapper.find(EuiCard).dive().shallow();

View file

@ -7,8 +7,7 @@
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { setMockValues } from '../__mocks__/kea.mock'; import { setMockValues, rerender } from '../__mocks__';
import { rerender } from '../__mocks__';
import { EnterpriseSearch } from './'; import { EnterpriseSearch } from './';
import { SetupGuide } from './components/setup_guide'; import { SetupGuide } from './components/setup_guide';

View file

@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../__mocks__/kea.mock';
import '../../__mocks__/shallow_useeffect.mock'; import '../../__mocks__/shallow_useeffect.mock';
import { setMockActions, setMockValues } from '../../__mocks__'; import { setMockActions, setMockValues } from '../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { setMockValues } from '../../__mocks__/kea.mock'; import { setMockValues, mockKibanaValues, mockHistory } from '../../__mocks__';
import { mockKibanaValues, mockHistory } from '../../__mocks__';
jest.mock('../react_router_helpers', () => ({ jest.mock('../react_router_helpers', () => ({
letBrowserHandleEvent: jest.fn(() => false), letBrowserHandleEvent: jest.fn(() => false),

View file

@ -5,8 +5,7 @@
*/ */
import '../../__mocks__/shallow_useeffect.mock'; import '../../__mocks__/shallow_useeffect.mock';
import { setMockValues } from '../../__mocks__/kea.mock'; import { setMockValues, mockKibanaValues, mockHistory } from '../../__mocks__';
import { mockKibanaValues, mockHistory } from '../../__mocks__';
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';

View file

@ -4,10 +4,9 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../__mocks__/kea.mock'; import { setMockValues } from '../../__mocks__/kea.mock';
import React from 'react'; import React from 'react';
import { useValues } from 'kea';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { EuiButton as EuiButtonExternal, EuiEmptyPrompt } from '@elastic/eui'; import { EuiButton as EuiButtonExternal, EuiEmptyPrompt } from '@elastic/eui';
@ -45,7 +44,7 @@ describe('NotFound', () => {
}); });
it('changes the support URL if the user has a gold+ license', () => { it('changes the support URL if the user has a gold+ license', () => {
(useValues as jest.Mock).mockReturnValueOnce({ hasGoldLicense: true }); setMockValues({ hasGoldLicense: true });
const wrapper = shallow(<NotFound product={APP_SEARCH_PLUGIN} />); const wrapper = shallow(<NotFound product={APP_SEARCH_PLUGIN} />);
const prompt = wrapper.find(EuiEmptyPrompt).dive().shallow(); const prompt = wrapper.find(EuiEmptyPrompt).dive().shallow();

View file

@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { setMockValues } from '../../__mocks__/kea.mock'; import { setMockValues, rerender } from '../../__mocks__';
import { rerender } from '../../__mocks__';
import React from 'react'; import React from 'react';
import { shallow, ShallowWrapper } from 'enzyme'; import { shallow, ShallowWrapper } from 'enzyme';

View file

@ -4,15 +4,16 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { resetContext } from 'kea'; import { LogicMounter } from '../__mocks__';
import { DEFAULT_INITIAL_APP_DATA } from '../../../common/__mocks__'; import { DEFAULT_INITIAL_APP_DATA } from '../../../common/__mocks__';
import { AppLogic } from './app_logic'; import { AppLogic } from './app_logic';
describe('AppLogic', () => { describe('AppLogic', () => {
const { mount } = new LogicMounter(AppLogic);
beforeEach(() => { beforeEach(() => {
resetContext({}); mount();
AppLogic.mount();
}); });
const DEFAULT_VALUES = { const DEFAULT_VALUES = {

View file

@ -5,7 +5,6 @@
*/ */
import '../__mocks__/shallow_useeffect.mock'; import '../__mocks__/shallow_useeffect.mock';
import '../__mocks__/kea.mock';
import { setMockValues, setMockActions, mockKibanaValues } from '../__mocks__'; import { setMockValues, setMockActions, mockKibanaValues } from '../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../../__mocks__/kea.mock';
import '../../../../../__mocks__/shallow_useeffect.mock'; import '../../../../../__mocks__/shallow_useeffect.mock';
import { setMockActions, setMockValues } from '../../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../../__mocks__';
import { import {
contentSources, contentSources,

View file

@ -4,9 +4,8 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { resetContext } from 'kea';
import { import {
LogicMounter,
mockFlashMessageHelpers, mockFlashMessageHelpers,
mockHttpValues, mockHttpValues,
expectedAsyncError, expectedAsyncError,
@ -30,6 +29,7 @@ import {
} from './add_source_logic'; } from './add_source_logic';
describe('AddSourceLogic', () => { describe('AddSourceLogic', () => {
const { mount } = new LogicMounter(AddSourceLogic);
const { http } = mockHttpValues; const { http } = mockHttpValues;
const { clearFlashMessages, flashAPIErrors } = mockFlashMessageHelpers; const { clearFlashMessages, flashAPIErrors } = mockFlashMessageHelpers;
@ -71,8 +71,7 @@ describe('AddSourceLogic', () => {
beforeEach(() => { beforeEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
resetContext({}); mount();
AddSourceLogic.mount();
}); });
it('has expected default values', () => { it('has expected default values', () => {

View file

@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../../__mocks__/kea.mock';
import '../../../../../__mocks__/shallow_useeffect.mock'; import '../../../../../__mocks__/shallow_useeffect.mock';
import { setMockValues } from '../../../../../__mocks__'; import { setMockValues } from '../../../../../__mocks__';
import { mergedAvailableSources } from '../../../../__mocks__/content_sources.mock'; import { mergedAvailableSources } from '../../../../__mocks__/content_sources.mock';

View file

@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../../__mocks__/kea.mock';
import '../../../../../__mocks__/shallow_useeffect.mock'; import '../../../../../__mocks__/shallow_useeffect.mock';
import { setMockActions, setMockValues } from '../../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../../__mocks__/kea.mock';
import '../../../../../__mocks__/shallow_useeffect.mock'; import '../../../../../__mocks__/shallow_useeffect.mock';
import { setMockActions, setMockValues } from '../../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../../__mocks__/kea.mock';
import '../../../../../__mocks__/shallow_useeffect.mock'; import '../../../../../__mocks__/shallow_useeffect.mock';
import { setMockActions, setMockValues } from '../../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../../__mocks__/kea.mock';
import '../../../../../__mocks__/shallow_useeffect.mock'; import '../../../../../__mocks__/shallow_useeffect.mock';
import { setMockActions, setMockValues } from '../../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../../__mocks__/kea.mock';
import '../../../../../__mocks__/shallow_useeffect.mock'; import '../../../../../__mocks__/shallow_useeffect.mock';
import { setMockActions, setMockValues } from '../../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,9 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../../__mocks__/kea.mock';
import '../../../../../__mocks__/shallow_useeffect.mock';
import { mountAsync, setMockValues } from '../../../../../__mocks__'; import { mountAsync, setMockValues } from '../../../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockValues, setMockActions } from '../../../../__mocks__'; import { setMockValues, setMockActions } from '../../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockActions } from '../../../../__mocks__'; import { setMockActions } from '../../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { users } from '../../../__mocks__/users.mock'; import { users } from '../../../__mocks__/users.mock';
import React from 'react'; import React from 'react';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockActions } from '../../../../__mocks__'; import { setMockActions } from '../../../../__mocks__';
import { users } from '../../../__mocks__/users.mock'; import { users } from '../../../__mocks__/users.mock';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockValues } from '../../../../__mocks__'; import { setMockValues } from '../../../../__mocks__';
import { groups } from '../../../__mocks__/groups.mock'; import { groups } from '../../../__mocks__/groups.mock';
import { contentSources } from '../../../__mocks__/content_sources.mock'; import { contentSources } from '../../../__mocks__/content_sources.mock';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockActions, setMockValues } from '../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../__mocks__';
import { groups } from '../../../__mocks__/groups.mock'; import { groups } from '../../../__mocks__/groups.mock';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockValues } from '../../../../__mocks__'; import { setMockValues } from '../../../../__mocks__';
import { groups } from '../../../__mocks__/groups.mock'; import { groups } from '../../../__mocks__/groups.mock';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { contentSources } from '../../../__mocks__/content_sources.mock'; import { contentSources } from '../../../__mocks__/content_sources.mock';
import React from 'react'; import React from 'react';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockActions, setMockValues } from '../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../__mocks__';
import { users } from '../../../__mocks__/users.mock'; import { users } from '../../../__mocks__/users.mock';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockActions, setMockValues } from '../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../__mocks__';
import { groups } from '../../../__mocks__/groups.mock'; import { groups } from '../../../__mocks__/groups.mock';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { contentSources } from '../../../__mocks__/content_sources.mock'; import { contentSources } from '../../../__mocks__/content_sources.mock';
import React from 'react'; import React from 'react';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockValues } from '../../../../__mocks__'; import { setMockValues } from '../../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { users } from '../../../__mocks__/users.mock'; import { users } from '../../../__mocks__/users.mock';
import React from 'react'; import React from 'react';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockValues } from '../../../../__mocks__'; import { setMockValues } from '../../../../__mocks__';
import { groups } from '../../../__mocks__/groups.mock'; import { groups } from '../../../__mocks__/groups.mock';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockActions, setMockValues } from '../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../__mocks__';
import { groups } from '../../../__mocks__/groups.mock'; import { groups } from '../../../__mocks__/groups.mock';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockActions, setMockValues } from '../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../__mocks__';
import { users } from '../../../__mocks__/users.mock'; import { users } from '../../../__mocks__/users.mock';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockActions, setMockValues } from '../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../__mocks__';
import { groups } from '../../../__mocks__/groups.mock'; import { groups } from '../../../__mocks__/groups.mock';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { contentSources } from '../../../__mocks__/content_sources.mock'; import { contentSources } from '../../../__mocks__/content_sources.mock';
import React from 'react'; import React from 'react';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { contentSources } from '../../../__mocks__/content_sources.mock'; import { contentSources } from '../../../__mocks__/content_sources.mock';
import React from 'react'; import React from 'react';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockActions, setMockValues } from '../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../__mocks__';
import { contentSources } from '../../../__mocks__/content_sources.mock'; import { contentSources } from '../../../__mocks__/content_sources.mock';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockActions, setMockValues } from '../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../__mocks__';
import { users } from '../../../__mocks__/users.mock'; import { users } from '../../../__mocks__/users.mock';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { setMockActions, setMockValues } from '../../../../__mocks__'; import { setMockActions, setMockValues } from '../../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../../__mocks__/kea.mock';
import { users } from '../../../__mocks__/users.mock'; import { users } from '../../../__mocks__/users.mock';
import React from 'react'; import React from 'react';

View file

@ -4,9 +4,8 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { resetContext } from 'kea';
import { import {
LogicMounter,
mockKibanaValues, mockKibanaValues,
mockFlashMessageHelpers, mockFlashMessageHelpers,
mockHttpValues, mockHttpValues,
@ -20,6 +19,7 @@ import { GroupLogic } from './group_logic';
import { GROUPS_PATH } from '../../routes'; import { GROUPS_PATH } from '../../routes';
describe('GroupLogic', () => { describe('GroupLogic', () => {
const { mount } = new LogicMounter(GroupLogic);
const { http } = mockHttpValues; const { http } = mockHttpValues;
const { navigateToUrl } = mockKibanaValues; const { navigateToUrl } = mockKibanaValues;
const { const {
@ -37,8 +37,7 @@ describe('GroupLogic', () => {
beforeEach(() => { beforeEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
resetContext({}); mount();
GroupLogic.mount();
}); });
it('has expected default values', () => { it('has expected default values', () => {

View file

@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../__mocks__/kea.mock';
import '../../../__mocks__/shallow_useeffect.mock'; import '../../../__mocks__/shallow_useeffect.mock';
import { setMockValues, setMockActions } from '../../../__mocks__'; import { setMockValues, setMockActions } from '../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../__mocks__/kea.mock';
import '../../../__mocks__/shallow_useeffect.mock'; import '../../../__mocks__/shallow_useeffect.mock';
import { setMockActions, setMockValues } from '../../../__mocks__'; import { setMockActions, setMockValues } from '../../../__mocks__';
import { groups } from '../../__mocks__/groups.mock'; import { groups } from '../../__mocks__/groups.mock';

View file

@ -4,9 +4,13 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { resetContext } from 'kea'; import {
LogicMounter,
mockFlashMessageHelpers,
mockHttpValues,
expectedAsyncError,
} from '../../../__mocks__';
import { mockFlashMessageHelpers, mockHttpValues, expectedAsyncError } from '../../../__mocks__';
import { DEFAULT_META } from '../../../shared/constants'; import { DEFAULT_META } from '../../../shared/constants';
import { JSON_HEADER as headers } from '../../../../../common/constants'; import { JSON_HEADER as headers } from '../../../../../common/constants';
@ -21,6 +25,7 @@ const TIMEOUT = 400;
const delay = () => new Promise((resolve) => setTimeout(resolve, TIMEOUT)); const delay = () => new Promise((resolve) => setTimeout(resolve, TIMEOUT));
describe('GroupsLogic', () => { describe('GroupsLogic', () => {
const { mount } = new LogicMounter(GroupsLogic);
const { http } = mockHttpValues; const { http } = mockHttpValues;
const { clearFlashMessages, flashAPIErrors } = mockFlashMessageHelpers; const { clearFlashMessages, flashAPIErrors } = mockFlashMessageHelpers;
@ -31,8 +36,7 @@ describe('GroupsLogic', () => {
beforeEach(() => { beforeEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
resetContext({}); mount();
GroupsLogic.mount();
}); });
it('has expected default values', () => { it('has expected default values', () => {

View file

@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import '../../../__mocks__/kea.mock';
import '../../../__mocks__/shallow_useeffect.mock'; import '../../../__mocks__/shallow_useeffect.mock';
import { setMockActions } from '../../../__mocks__'; import { setMockActions } from '../../../__mocks__';
import React from 'react'; import React from 'react';

View file

@ -4,20 +4,18 @@
* you may not use this file except in compliance with the Elastic License. * you may not use this file except in compliance with the Elastic License.
*/ */
import { resetContext } from 'kea'; import { LogicMounter, mockHttpValues } from '../../../__mocks__';
import { mockHttpValues } from '../../../__mocks__';
import { mockOverviewValues } from './__mocks__'; import { mockOverviewValues } from './__mocks__';
import { OverviewLogic } from './overview_logic'; import { OverviewLogic } from './overview_logic';
describe('OverviewLogic', () => { describe('OverviewLogic', () => {
const { mount } = new LogicMounter(OverviewLogic);
const { http } = mockHttpValues; const { http } = mockHttpValues;
beforeEach(() => { beforeEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
resetContext({}); mount();
OverviewLogic.mount();
}); });
it('has expected default values', () => { it('has expected default values', () => {