diff --git a/packages/kbn-test/src/jest/utils/testbed/index.ts b/packages/kbn-test/src/jest/utils/testbed/index.ts index dfa5f011853c0..0e839c180b6b6 100644 --- a/packages/kbn-test/src/jest/utils/testbed/index.ts +++ b/packages/kbn-test/src/jest/utils/testbed/index.ts @@ -7,4 +7,12 @@ */ export { registerTestBed } from './testbed'; -export type { TestBed, TestBedConfig, SetupFunc, UnwrapPromise } from './types'; +export type { + TestBed, + TestBedConfig, + AsyncTestBedConfig, + SetupFunc, + UnwrapPromise, + SyncSetupFunc, + AsyncSetupFunc, +} from './types'; diff --git a/packages/kbn-test/src/jest/utils/testbed/testbed.ts b/packages/kbn-test/src/jest/utils/testbed/testbed.ts index 472b9f2df939c..240ec25a9c296 100644 --- a/packages/kbn-test/src/jest/utils/testbed/testbed.ts +++ b/packages/kbn-test/src/jest/utils/testbed/testbed.ts @@ -16,7 +16,14 @@ import { mountComponentAsync, getJSXComponentWithProps, } from './mount_component'; -import { TestBedConfig, TestBed, SetupFunc } from './types'; +import { + TestBedConfig, + AsyncTestBedConfig, + TestBed, + SetupFunc, + SyncSetupFunc, + AsyncSetupFunc, +} from './types'; const defaultConfig: TestBedConfig = { defaultProps: {}, @@ -48,10 +55,18 @@ const defaultConfig: TestBedConfig = { }); ``` */ -export const registerTestBed = ( +export function registerTestBed( + Component: ComponentType, + config: AsyncTestBedConfig +): AsyncSetupFunc; +export function registerTestBed( Component: ComponentType, config?: TestBedConfig -): SetupFunc => { +): SyncSetupFunc; +export function registerTestBed( + Component: ComponentType, + config?: AsyncTestBedConfig | TestBedConfig +): SetupFunc { const { defaultProps = defaultConfig.defaultProps, memoryRouter = defaultConfig.memoryRouter!, @@ -188,7 +203,7 @@ export const registerTestBed = ( value, isAsync = false ) => { - const formInput = typeof input === 'string' ? find(input) : (input as ReactWrapper); + const formInput = typeof input === 'string' ? find(input) : input; if (!formInput.length) { throw new Error(`Input "${input}" was not found.`); @@ -207,7 +222,7 @@ export const registerTestBed = ( value, doUpdateComponent = true ) => { - const formSelect = typeof select === 'string' ? find(select) : (select as ReactWrapper); + const formSelect = typeof select === 'string' ? find(select) : select; if (!formSelect.length) { throw new Error(`Select "${select}" was not found.`); @@ -314,7 +329,7 @@ export const registerTestBed = ( router.history.push(url); }; - return { + const testBed: TestBed = { component, exists, find, @@ -336,8 +351,10 @@ export const registerTestBed = ( navigateTo, }, }; + + return testBed; } }; return setup; -}; +} diff --git a/packages/kbn-test/src/jest/utils/testbed/types.ts b/packages/kbn-test/src/jest/utils/testbed/types.ts index bba504951c0bc..121b848e51b51 100644 --- a/packages/kbn-test/src/jest/utils/testbed/types.ts +++ b/packages/kbn-test/src/jest/utils/testbed/types.ts @@ -7,10 +7,13 @@ */ import { Store } from 'redux'; -import { ReactWrapper } from 'enzyme'; +import { ReactWrapper as GenericReactWrapper } from 'enzyme'; import { LocationDescriptor } from 'history'; +export type AsyncSetupFunc = (props?: any) => Promise>; +export type SyncSetupFunc = (props?: any) => TestBed; export type SetupFunc = (props?: any) => TestBed | Promise>; +export type ReactWrapper = GenericReactWrapper; export interface EuiTableMetaData { /** Array of rows of the table. Each row exposes its reactWrapper and its columns */ @@ -51,7 +54,7 @@ export interface TestBed { find('myForm.nameInput'); ``` */ - find: (testSubject: T, reactWrapper?: ReactWrapper) => ReactWrapper; + find: (testSubject: T, reactWrapper?: ReactWrapper) => ReactWrapper; /** * Update the props of the mounted component * @@ -147,15 +150,23 @@ export interface TestBed { }; } -export interface TestBedConfig { +export interface BaseTestBedConfig { /** The default props to pass to the mounted component. */ defaultProps?: Record; /** Configuration object for the react-router `MemoryRouter. */ memoryRouter?: MemoryRouterConfig; /** An optional redux store. You can also provide a function that returns a store. */ store?: (() => Store) | Store | null; +} + +export interface AsyncTestBedConfig extends BaseTestBedConfig { + /* Mount the component asynchronously. When using "hooked" components with _useEffect()_ calls, you need to set this to "true". */ + doMountAsync: true; +} + +export interface TestBedConfig extends BaseTestBedConfig { /* Mount the component asynchronously. When using "hooked" components with _useEffect()_ calls, you need to set this to "true". */ - doMountAsync?: boolean; + doMountAsync?: false; } export interface MemoryRouterConfig { diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts index 311acb13d3f06..e3184cadbdc49 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts @@ -9,7 +9,7 @@ import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; import { EuiDescriptionListDescription } from '@elastic/eui'; -import { registerTestBed, TestBed, TestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; import { DataStream } from '../../../common'; import { IndexManagementHome } from '../../../public/application/sections/home'; import { indexManagementStore } from '../../../public/application/store'; @@ -42,7 +42,7 @@ export interface DataStreamsTabTestBed extends TestBed { } export const setup = async (overridingDependencies: any = {}): Promise => { - const testBedConfig: TestBedConfig = { + const testBedConfig: AsyncTestBedConfig = { store: () => indexManagementStore(services as any), memoryRouter: { initialEntries: [`/indices`], diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts index a15e4f2a613d3..ad8aceb7d56b8 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { IndexManagementHome } from '../../../public/application/sections/home'; import { indexManagementStore } from '../../../public/application/store'; import { WithAppDependencies, services, TestSubjects } from '../helpers'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { store: () => indexManagementStore(services as any), memoryRouter: { initialEntries: [`/indices?includeHidden=true`], diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts index 7431686c02bbf..4ddd14562577a 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts @@ -7,12 +7,12 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; import { TemplateList } from '../../../public/application/sections/home/template_list'; import { TemplateDeserialized } from '../../../common'; import { WithAppDependencies, TestSubjects } from '../helpers'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`/templates`], componentRoutePath: `/templates/:templateName?`, diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts index 2576b5f92b7b2..0e4564163c553 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts @@ -8,12 +8,12 @@ import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; -import { registerTestBed, TestBed, TestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; import { IndexManagementHome } from '../../../public/application/sections/home'; import { indexManagementStore } from '../../../public/application/store'; import { WithAppDependencies, services, TestSubjects } from '../helpers'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { store: () => indexManagementStore(services as any), memoryRouter: { initialEntries: [`/indices?includeHiddenIndices=true`], diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts index 222bee28aef4b..dffa6fee19d06 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { TemplateClone } from '../../../public/application/sections/template_clone'; import { WithAppDependencies } from '../helpers'; import { formSetup } from './template_form.helpers'; import { TEMPLATE_NAME } from './constants'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`/clone_template/${TEMPLATE_NAME}`], componentRoutePath: `/clone_template/:name`, diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts index 7d3b34a6b8238..450d2c524b445 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { TemplateCreate } from '../../../public/application/sections/template_create'; import { WithAppDependencies } from '../helpers'; @@ -16,7 +16,7 @@ export const setup: any = (isLegacy: boolean = false) => { ? { pathname: '/create_template', search: '?legacy=true' } : { pathname: '/create_template' }; - const testBedConfig: TestBedConfig = { + const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [route], componentRoutePath: route, diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts index e087c9432c4c2..6c73da3b3379d 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { TemplateEdit } from '../../../public/application/sections/template_edit'; import { WithAppDependencies } from '../helpers'; import { formSetup, TestSubjects } from './template_form.helpers'; import { TEMPLATE_NAME } from './constants'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`/edit_template/${TEMPLATE_NAME}`], componentRoutePath: `/edit_template/:name`, diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts index 9d28d57e531cb..06f0036cc5c77 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { BASE_PATH } from '../../../../../../../common'; import { ComponentTemplateCreate } from '../../../component_template_wizard'; @@ -19,7 +19,7 @@ export type ComponentTemplateCreateTestBed = TestBed; }; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`${BASE_PATH}/create_component_template`], componentRoutePath: `${BASE_PATH}/create_component_template`, diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts index 093a01d8db41c..e7b8df245aaa9 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { BASE_PATH } from '../../../../../../../common'; import { ComponentTemplateEdit } from '../../../component_template_wizard'; @@ -19,7 +19,7 @@ export type ComponentTemplateEditTestBed = TestBed; }; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`${BASE_PATH}/edit_component_template/comp-1`], componentRoutePath: `${BASE_PATH}/edit_component_template/:name`, diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts index a8d548a9bf2b8..680550d16096b 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts @@ -7,12 +7,18 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig, findTestSubject, nextTick } from '@kbn/test/jest'; +import { + registerTestBed, + TestBed, + AsyncTestBedConfig, + findTestSubject, + nextTick, +} from '@kbn/test/jest'; import { BASE_PATH } from '../../../../../../../common'; import { WithAppDependencies } from './setup_environment'; import { ComponentTemplateList } from '../../../component_template_list/component_template_list'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`${BASE_PATH}component_templates`], componentRoutePath: `${BASE_PATH}component_templates`, diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts index cf30870cefbbd..51f6d9bd96bd6 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBedConfig, TestBed } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig, TestBed } from '@kbn/test/jest'; import { PipelinesClone } from '../../../public/application/sections/pipelines_clone'; import { getFormActions, PipelineFormTestSubjects } from './pipeline_form.helpers'; import { WithAppDependencies } from './setup_environment'; @@ -28,7 +28,7 @@ export const PIPELINE_TO_CLONE = { ], }; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [getClonePath({ clonedPipelineName: PIPELINE_TO_CLONE.name })], componentRoutePath: ROUTES.clone, diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts index 06c880bbceda4..faf1b42042ec1 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBedConfig, TestBed } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig, TestBed } from '@kbn/test/jest'; import { PipelinesCreate } from '../../../public/application/sections/pipelines_create'; import { getFormActions, PipelineFormTestSubjects } from './pipeline_form.helpers'; import { WithAppDependencies } from './setup_environment'; @@ -15,7 +15,7 @@ export type PipelinesCreateTestBed = TestBed & { actions: ReturnType; }; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [getCreatePath()], componentRoutePath: ROUTES.create, diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts index 913eb1355a6d7..9a3c41196653f 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBedConfig, TestBed } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig, TestBed } from '@kbn/test/jest'; import { PipelinesEdit } from '../../../public/application/sections/pipelines_edit'; import { getFormActions, PipelineFormTestSubjects } from './pipeline_form.helpers'; import { WithAppDependencies } from './setup_environment'; @@ -28,7 +28,7 @@ export const PIPELINE_TO_EDIT = { ], }; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [getEditPath({ pipelineName: PIPELINE_TO_EDIT.name })], componentRoutePath: ROUTES.edit, diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts index 5f340b645f954..3cd768104203a 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts @@ -7,12 +7,12 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; import { PipelinesList } from '../../../public/application/sections/pipelines_list'; import { WithAppDependencies } from './setup_environment'; import { getListPath, ROUTES } from '../../../public/application/services/navigation'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [getListPath()], componentRoutePath: ROUTES.list, diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts index 71930efe12953..1e16fa2a40129 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts @@ -7,12 +7,18 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, findTestSubject, TestBed, TestBedConfig, delay } from '@kbn/test/jest'; +import { + registerTestBed, + findTestSubject, + TestBed, + AsyncTestBedConfig, + delay, +} from '@kbn/test/jest'; import { SnapshotRestoreHome } from '../../../public/application/sections/home/home'; import { BASE_PATH } from '../../../public/application/constants'; import { WithAppDependencies } from './setup_environment'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`${BASE_PATH}/repositories`], componentRoutePath: `${BASE_PATH}/:section(repositories|snapshots)/:repositoryName?/:snapshotId*`, diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts index b3eeaeedbbe52..a6e7c4a4c1056 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { PolicyAdd } from '../../../public/application/sections/policy_add'; import { formSetup, PolicyFormTestSubjects } from './policy_form.helpers'; import { WithAppDependencies } from './setup_environment'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: ['/add_policy'], componentRoutePath: '/add_policy', diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts index 71b500ac73263..2014d22ffbfbc 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { PolicyEdit } from '../../../public/application/sections/policy_edit'; import { WithAppDependencies } from './setup_environment'; import { POLICY_NAME } from './constant'; import { formSetup, PolicyFormTestSubjects } from './policy_form.helpers'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`/edit_policy/${POLICY_NAME}`], componentRoutePath: '/edit_policy/:name', diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts index 9a6f0d9a76bd1..f0563f2831a98 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { RepositoryEdit } from '../../../public/application/sections/repository_edit'; import { WithAppDependencies } from './setup_environment'; import { REPOSITORY_NAME } from './constant'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`/${REPOSITORY_NAME}`], componentRoutePath: '/:name', diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts index 9b82c1d5b6364..123ae0cbb1c2e 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts @@ -6,11 +6,11 @@ */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { RestoreSnapshot } from '../../../public/application/sections/restore_snapshot'; import { WithAppDependencies } from './setup_environment'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: ['/add_policy'], componentRoutePath: '/add_policy', diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/app/app.helpers.tsx b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/app/app.helpers.tsx index 23726e05b895d..55c8c7f721a49 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/app/app.helpers.tsx +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/app/app.helpers.tsx @@ -6,12 +6,12 @@ */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { App } from '../../../public/application/app'; import { WithAppDependencies } from '../helpers'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`/overview`], componentRoutePath: '/overview', diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/es_deprecations.helpers.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/es_deprecations.helpers.ts index 9bb44a9314c52..28ec1983cbeda 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/es_deprecations.helpers.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/es_deprecations.helpers.ts @@ -6,11 +6,11 @@ */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { EsDeprecations } from '../../../public/application/components/es_deprecations'; import { WithAppDependencies } from '../helpers'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: ['/es_deprecations'], componentRoutePath: '/es_deprecations', diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/kibana_deprecations.helpers.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/kibana_deprecations.helpers.ts index 345a06d3d80a0..8d14a211786c4 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/kibana_deprecations.helpers.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/kibana_deprecations.helpers.ts @@ -5,11 +5,11 @@ * 2.0. */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; import { KibanaDeprecations } from '../../../public/application/components'; import { WithAppDependencies } from '../helpers'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: ['/kibana_deprecations'], componentRoutePath: '/kibana_deprecations', diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.helpers.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.helpers.ts index 242d6893d1518..d8bd6a9ff5d83 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.helpers.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.helpers.ts @@ -6,11 +6,11 @@ */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { Overview } from '../../../public/application/components/overview'; import { WithAppDependencies } from '../helpers'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`/overview`], componentRoutePath: '/overview', diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts index 696a266ca4a3e..a276b717bc544 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES, WATCH_TYPES } from '../../../common/constants'; import { withAppContext } from './app_context.mock'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { onRouter: (router) => registerRouter(router), initialEntries: [`${ROUTES.API_ROOT}/watches/new-watch/${WATCH_TYPES.JSON}`], diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts index caddf1df93d40..320f88eef2651 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES, WATCH_TYPES } from '../../../common/constants'; import { withAppContext } from './app_context.mock'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { onRouter: (router) => registerRouter(router), initialEntries: [`${ROUTES.API_ROOT}/watches/new-watch/${WATCH_TYPES.THRESHOLD}`], diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts index 957755c9e5361..15489fa0a864d 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES } from '../../../common/constants'; import { WATCH_ID } from './jest_constants'; import { withAppContext } from './app_context.mock'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { onRouter: (router) => registerRouter(router), initialEntries: [`${ROUTES.API_ROOT}/watches/watch/${WATCH_ID}/edit`], diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts index c0643e70dded9..d048a55422f6e 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts @@ -7,12 +7,12 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, findTestSubject, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, findTestSubject, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { WatchList } from '../../../public/application/sections/watch_list/components/watch_list'; import { ROUTES, REFRESH_INTERVALS } from '../../../common/constants'; import { withAppContext } from './app_context.mock'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`${ROUTES.API_ROOT}/watches`], }, diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts index 02b6908fc1d4c..0578f9f1092a1 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts @@ -7,13 +7,13 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, findTestSubject, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, findTestSubject, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { WatchStatus } from '../../../public/application/sections/watch_status/components/watch_status'; import { ROUTES } from '../../../common/constants'; import { WATCH_ID } from './jest_constants'; import { withAppContext } from './app_context.mock'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`${ROUTES.API_ROOT}/watches/watch/${WATCH_ID}/status`], componentRoutePath: `${ROUTES.API_ROOT}/watches/watch/:id/status`,