diff --git a/x-pack/plugins/index_management/__jest__/components/index_table.test.js b/x-pack/plugins/index_management/__jest__/components/index_table.test.js index 5e5538fcca4e8..60d72cc024f6a 100644 --- a/x-pack/plugins/index_management/__jest__/components/index_table.test.js +++ b/x-pack/plugins/index_management/__jest__/components/index_table.test.js @@ -8,10 +8,7 @@ import React from 'react'; import { Provider } from 'react-redux'; import { MemoryRouter } from 'react-router-dom'; -import axios from 'axios'; -import sinon from 'sinon'; import { findTestSubject } from '@elastic/eui/lib/test'; -import axiosXhrAdapter from 'axios/lib/adapters/xhr'; /** * The below import is required to avoid a console error warn from brace package @@ -19,9 +16,11 @@ import axiosXhrAdapter from 'axios/lib/adapters/xhr'; Could not load worker ReferenceError: Worker is not defined at createWorker (//node_modules/brace/index.js:17992:5) */ + import { mountWithIntl, stubWebWorker } from '@kbn/test/jest'; // eslint-disable-line no-unused-vars +import { init as initHttpRequests } from '../client_integration/helpers/http_requests'; -import { BASE_PATH, API_BASE_PATH } from '../../common/constants'; +import { BASE_PATH } from '../../common/constants'; import { AppWithoutRouter } from '../../public/application/app'; import { AppContextProvider } from '../../public/application/app_context'; import { loadIndicesSuccess } from '../../public/application/store/actions'; @@ -38,9 +37,6 @@ import { kibanaVersion } from '../client_integration/helpers'; /* eslint-disable @kbn/eslint/no-restricted-paths */ import { notificationServiceMock } from '../../../../../src/core/public/notifications/notifications_service.mock'; -const mockHttpClient = axios.create({ adapter: axiosXhrAdapter }); - -let server = null; let store = null; const indices = []; @@ -147,6 +143,8 @@ const getActionMenuButtons = (rendered) => { .map((span) => span.text()); }; describe('index table', () => { + const { httpSetup, httpRequestsMockHelpers } = initHttpRequests(); + beforeEach(() => { // Mock initialization of services const services = { @@ -157,8 +155,7 @@ describe('index table', () => { setExtensionsService(services.extensionsService); setUiMetricService(services.uiMetricService); - // @ts-ignore - httpService.setup(mockHttpClient); + httpService.setup(httpSetup); breadcrumbService.setup(() => undefined); notificationService.setup(notificationServiceMock.createStartContract()); @@ -177,33 +174,9 @@ describe('index table', () => { ); store.dispatch(loadIndicesSuccess({ indices })); - server = sinon.fakeServer.create(); - - server.respondWith(`${API_BASE_PATH}/indices`, [ - 200, - { 'Content-Type': 'application/json' }, - JSON.stringify(indices), - ]); - - server.respondWith([ - 200, - { 'Content-Type': 'application/json' }, - JSON.stringify({ acknowledged: true }), - ]); - - server.respondWith(`${API_BASE_PATH}/indices/reload`, [ - 200, - { 'Content-Type': 'application/json' }, - JSON.stringify(indices), - ]); - - server.respondImmediately = true; - }); - afterEach(() => { - if (!server) { - return; - } - server.restore(); + + httpRequestsMockHelpers.setLoadIndicesResponse(indices); + httpRequestsMockHelpers.setReloadIndicesResponse(indices); }); test('should change pages when a pagination link is clicked on', async () => { @@ -467,22 +440,17 @@ describe('index table', () => { }); test('close index button works from context menu', async () => { - const rendered = mountWithIntl(component); - await runAllPromises(); - rendered.update(); - const modifiedIndices = indices.map((index) => { return { ...index, status: index.name === 'testy0' ? 'close' : index.status, }; }); + httpRequestsMockHelpers.setReloadIndicesResponse(modifiedIndices); - server.respondWith(`${API_BASE_PATH}/indices/reload`, [ - 200, - { 'Content-Type': 'application/json' }, - JSON.stringify(modifiedIndices), - ]); + const rendered = mountWithIntl(component); + await runAllPromises(); + rendered.update(); testAction(rendered, 'closeIndexMenuButton'); }); @@ -494,16 +462,12 @@ describe('index table', () => { status: index.name === 'testy1' ? 'closed' : index.status, }; }); - - server.respondWith(`${API_BASE_PATH}/indices`, [ - 200, - { 'Content-Type': 'application/json' }, - JSON.stringify(modifiedIndices), - ]); + httpRequestsMockHelpers.setLoadIndicesResponse(modifiedIndices); const rendered = mountWithIntl(component); await runAllPromises(); rendered.update(); + testAction(rendered, 'openIndexMenuButton', 'testy1'); }); diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/append.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/append.test.tsx index af3651525d6a3..f35e05b800f14 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/append.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/append.test.tsx @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; const APPEND_TYPE = 'append'; @@ -14,6 +14,8 @@ describe('Processor: Append', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); + beforeAll(() => { jest.useFakeTimers(); }); @@ -26,7 +28,7 @@ describe('Processor: Append', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/bytes.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/bytes.test.tsx index 51117c3b517f9..d4ac176d6aaf5 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/bytes.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/bytes.test.tsx @@ -6,13 +6,14 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; const BYTES_TYPE = 'bytes'; describe('Processor: Bytes', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -26,7 +27,7 @@ describe('Processor: Bytes', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/circle.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/circle.test.tsx index b8c8f6c58f711..00153471ea65e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/circle.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/circle.test.tsx @@ -6,13 +6,14 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; const CIRCLE_TYPE = 'circle'; describe('Processor: Circle', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -26,7 +27,7 @@ describe('Processor: Circle', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/common_processor_fields.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/common_processor_fields.test.tsx index af5c8c50abf7b..ebffd5adf78c1 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/common_processor_fields.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/common_processor_fields.test.tsx @@ -6,13 +6,14 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; const BYTES_TYPE = 'bytes'; describe('Processor: Common Fields For All Processors', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -26,7 +27,7 @@ describe('Processor: Common Fields For All Processors', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx index 0338cb8e04348..e571474576ff2 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx @@ -6,13 +6,14 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; const COMMUNITY_ID_TYPE = 'community_id'; describe('Processor: Community id', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -26,7 +27,7 @@ describe('Processor: Community id', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/convert.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/convert.test.tsx index 5a58a7b595c90..3090e59b32e0b 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/convert.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/convert.test.tsx @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; // Default parameter values automatically added to the `convert processor` when saved const defaultConvertParameters = { @@ -23,6 +23,7 @@ const CONVERT_TYPE = 'convert'; describe('Processor: Convert', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -36,7 +37,7 @@ describe('Processor: Convert', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/csv.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/csv.test.tsx index b40b46967dae5..6414976b56f9a 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/csv.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/csv.test.tsx @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; // Default parameter values automatically added to the CSV processor when saved const defaultCSVParameters = { @@ -26,6 +26,7 @@ const CSV_TYPE = 'csv'; describe('Processor: CSV', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -39,7 +40,7 @@ describe('Processor: CSV', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/date.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/date.test.tsx index 390f8e0191ce9..22666ebbe2a98 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/date.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/date.test.tsx @@ -6,13 +6,14 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; const DATE_TYPE = 'date'; describe('Processor: Date', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -26,7 +27,7 @@ describe('Processor: Date', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/date_index.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/date_index.test.tsx index 264db2c5b65c0..b9e990f36c15b 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/date_index.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/date_index.test.tsx @@ -6,13 +6,14 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; const DATE_INDEX_TYPE = 'date_index_name'; describe('Processor: Date Index Name', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -26,7 +27,7 @@ describe('Processor: Date Index Name', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/dot_expander.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/dot_expander.test.tsx index 75468f31b1a54..9411c3c0104ff 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/dot_expander.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/dot_expander.test.tsx @@ -6,13 +6,14 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; const DOT_EXPANDER_TYPE = 'dot_expander'; describe('Processor: Dot Expander', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -26,7 +27,7 @@ describe('Processor: Dot Expander', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fail.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fail.test.tsx index db5840379536a..9b8148bd0dffd 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fail.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fail.test.tsx @@ -6,12 +6,13 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; const FAIL_TYPE = 'fail'; describe('Processor: Fail', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -25,7 +26,7 @@ describe('Processor: Fail', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx index 7c2ca012a0460..49d7937fab002 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; // Default parameter values automatically added to the registered domain processor when saved const defaultFingerprintParameters = { @@ -25,6 +25,7 @@ const FINGERPRINT_TYPE = 'fingerprint'; describe('Processor: Fingerprint', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -38,7 +39,7 @@ describe('Processor: Fingerprint', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/network_direction.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/network_direction.test.tsx index 7a4c55d6f5e02..4f92aec06efd3 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/network_direction.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/network_direction.test.tsx @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; // Default parameter values automatically added to the network direction processor when saved const defaultNetworkDirectionParameters = { @@ -27,6 +27,7 @@ const NETWORK_DIRECTION_TYPE = 'network_direction'; describe('Processor: Network Direction', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -40,7 +41,7 @@ describe('Processor: Network Direction', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor.helpers.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor.helpers.tsx index 56b58a7a182d0..bc01822fccfa2 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor.helpers.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor.helpers.tsx @@ -7,11 +7,10 @@ import { act } from 'react-dom/test-utils'; import React from 'react'; -import axios from 'axios'; -import axiosXhrAdapter from 'axios/lib/adapters/xhr'; /* eslint-disable @kbn/eslint/no-restricted-paths */ import { usageCollectionPluginMock } from 'src/plugins/usage_collection/public/mocks'; +import { HttpSetup } from 'kibana/public'; import { registerTestBed, TestBed } from '@kbn/test/jest'; import { stubWebWorker } from '@kbn/test/jest'; @@ -103,7 +102,9 @@ const createActions = (testBed: TestBed) => { }; }; -export const setup = async (props: Props): Promise => { +export const setup = async (httpSetup: HttpSetup, props: Props): Promise => { + apiService.setup(httpSetup, uiMetricService); + const testBed = testBedSetup(props); return { ...testBed, @@ -111,19 +112,11 @@ export const setup = async (props: Props): Promise => { }; }; -const mockHttpClient = axios.create({ adapter: axiosXhrAdapter }); - export const setupEnvironment = () => { // Initialize mock services uiMetricService.setup(usageCollectionPluginMock.createSetupContract()); - // @ts-ignore - apiService.setup(mockHttpClient, uiMetricService); - - const { httpRequestsMockHelpers } = initHttpRequests(); - return { - httpRequestsMockHelpers, - }; + return initHttpRequests(); }; export const getProcessorValue = (onUpdate: jest.Mock, type: string) => { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor_form.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor_form.test.tsx index de0061dcb0407..b2e2fb81f2c86 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor_form.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor_form.test.tsx @@ -6,11 +6,12 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult } from './processor.helpers'; +import { setup, SetupResult, setupEnvironment } from './processor.helpers'; describe('Processor: Bytes', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -24,7 +25,7 @@ describe('Processor: Bytes', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/registered_domain.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/registered_domain.test.tsx index 962e099f5b667..dcf332912a94b 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/registered_domain.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/registered_domain.test.tsx @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; // Default parameter values automatically added to the registered domain processor when saved const defaultRegisteredDomainParameters = { @@ -21,6 +21,7 @@ const REGISTERED_DOMAIN_TYPE = 'registered_domain'; describe('Processor: Registered Domain', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -34,7 +35,7 @@ describe('Processor: Registered Domain', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/set.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/set.test.tsx index 544b8aeb51c05..ebfa678648904 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/set.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/set.test.tsx @@ -6,13 +6,14 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; const SET_TYPE = 'set'; describe('Processor: Set', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -26,7 +27,7 @@ describe('Processor: Set', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/uri_parts.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/uri_parts.test.tsx index 442788a7f75aa..9062fcc02f7f8 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/uri_parts.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/uri_parts.test.tsx @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; // Default parameter values automatically added to the URI parts processor when saved const defaultUriPartsParameters = { @@ -19,6 +19,7 @@ const URI_PARTS_TYPE = 'uri_parts'; describe('Processor: URI parts', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -32,7 +33,7 @@ describe('Processor: URI parts', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/user_agent.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/user_agent.test.tsx index fa1c24c9dfb39..ed778aa1cc1f3 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/user_agent.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/user_agent.test.tsx @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { setup, SetupResult, getProcessorValue } from './processor.helpers'; +import { setup, SetupResult, getProcessorValue, setupEnvironment } from './processor.helpers'; // Default parameter values automatically added to the user agent processor when saved const defaultUserAgentParameters = { @@ -24,6 +24,7 @@ const USER_AGENT_TYPE = 'user_agent'; describe('Processor: User Agent', () => { let onUpdate: jest.Mock; let testBed: SetupResult; + const { httpSetup } = setupEnvironment(); beforeAll(() => { jest.useFakeTimers(); @@ -37,7 +38,7 @@ describe('Processor: User Agent', () => { onUpdate = jest.fn(); await act(async () => { - testBed = await setup({ + testBed = await setup(httpSetup, { value: { processors: [], },