[Security Solution] Move component tests to jest integration (#143233)

This commit is contained in:
Kevin Logan 2022-10-13 12:14:47 -04:00 committed by GitHub
parent ec98f01c9f
commit 97eb9b6163
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 27 deletions

View file

@ -6,18 +6,17 @@
*/
import React from 'react';
import type { AppContextTestRender } from '../../../../../common/mock/endpoint';
import { createAppRootMockRenderer } from '../../../../../common/mock/endpoint';
import { endpointPageHttpMock } from '../../mocks';
import type { AppContextTestRender } from '../../../../../../common/mock/endpoint';
import { createAppRootMockRenderer } from '../../../../../../common/mock/endpoint';
import { endpointPageHttpMock } from '../../../mocks';
import { act, waitFor, cleanup } from '@testing-library/react';
import { getEndpointListPath } from '../../../../common/routing';
import { AdminSearchBar } from './search_bar';
import { getEndpointListPath } from '../../../../../common/routing';
import { AdminSearchBar } from '../search_bar';
import { fireEvent } from '@testing-library/dom';
import { uiQueryParams } from '../../store/selectors';
import type { EndpointIndexUIQueryParams } from '../../types';
import { uiQueryParams } from '../../../store/selectors';
import type { EndpointIndexUIQueryParams } from '../../../types';
// FLAKY: https://github.com/elastic/kibana/issues/140618
describe.skip('when rendering the endpoint list `AdminSearchBar`', () => {
describe('when rendering the endpoint list `AdminSearchBar`', () => {
let render: (
urlParams?: EndpointIndexUIQueryParams
) => Promise<ReturnType<AppContextTestRender['render']>>;
@ -85,8 +84,7 @@ describe.skip('when rendering the endpoint list `AdminSearchBar`', () => {
expect(getQueryParamsFromStore().admin_query).toBe("(language:kuery,query:'host.name: foo')");
});
// FLAKY: https://github.com/elastic/kibana/issues/132398
it.skip.each([
it.each([
['nothing', ''],
['spaces', ' '],
])(

View file

@ -8,13 +8,13 @@
import { act, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';
import { EVENT_FILTERS_PATH } from '../../../../../common/constants';
import type { AppContextTestRender } from '../../../../common/mock/endpoint';
import { createAppRootMockRenderer } from '../../../../common/mock/endpoint';
import { EventFiltersList } from './event_filters_list';
import { exceptionsListAllHttpMocks } from '../../../mocks/exceptions_list_http_mocks';
import { SEARCHABLE_FIELDS } from '../constants';
import { parseQueryFilterToKQL } from '../../../common/utils';
import { EVENT_FILTERS_PATH } from '../../../../../../common/constants';
import type { AppContextTestRender } from '../../../../../common/mock/endpoint';
import { createAppRootMockRenderer } from '../../../../../common/mock/endpoint';
import { EventFiltersList } from '../event_filters_list';
import { exceptionsListAllHttpMocks } from '../../../../mocks/exceptions_list_http_mocks';
import { SEARCHABLE_FIELDS } from '../../constants';
import { parseQueryFilterToKQL } from '../../../../common/utils';
describe('When on the Event Filters list page', () => {
let render: () => ReturnType<AppContextTestRender['render']>;

View file

@ -7,14 +7,14 @@
import React from 'react';
import { ManagementContainer } from '.';
import '../../common/mock/match_media';
import type { AppContextTestRender } from '../../common/mock/endpoint';
import { createAppRootMockRenderer } from '../../common/mock/endpoint';
import { useUserPrivileges } from '../../common/components/user_privileges';
import { endpointPageHttpMock } from './endpoint_hosts/mocks';
import { ManagementContainer } from '..';
import '../../../common/mock/match_media';
import type { AppContextTestRender } from '../../../common/mock/endpoint';
import { createAppRootMockRenderer } from '../../../common/mock/endpoint';
import { useUserPrivileges } from '../../../common/components/user_privileges';
import { endpointPageHttpMock } from '../endpoint_hosts/mocks';
jest.mock('../../common/components/user_privileges');
jest.mock('../../../common/components/user_privileges');
describe('when in the Administration tab', () => {
let render: () => ReturnType<AppContextTestRender['render']>;
@ -34,8 +34,7 @@ describe('when in the Administration tab', () => {
expect(await render().findByTestId('noIngestPermissions')).not.toBeNull();
});
// FLAKY: https://github.com/elastic/kibana/issues/135166
it.skip('should display the Management view if user has privileges', async () => {
it('should display the Management view if user has privileges', async () => {
(useUserPrivileges as jest.Mock).mockReturnValue({
endpointPrivileges: { loading: false, canAccessEndpointManagement: true },
});