diff --git a/packages/kbn-management/settings/components/field_input/input/number_input.test.tsx b/packages/kbn-management/settings/components/field_input/input/number_input.test.tsx index 4d3b5ef9a405..7257a5395f2f 100644 --- a/packages/kbn-management/settings/components/field_input/input/number_input.test.tsx +++ b/packages/kbn-management/settings/components/field_input/input/number_input.test.tsx @@ -85,11 +85,11 @@ describe('NumberInput', () => { expect(input).toBeDisabled(); }); - it('recovers if value is null', () => { + it('recovers if value is null', async () => { const { getByTestId } = render( wrap() ); - const input = getByTestId(`${TEST_SUBJ_PREFIX_FIELD}-${id}`); - waitFor(() => expect(input).toHaveValue(undefined)); + + await waitFor(() => expect(getByTestId(`${TEST_SUBJ_PREFIX_FIELD}-${id}`)).toHaveValue(null)); }); }); diff --git a/packages/kbn-unsaved-changes-prompt/src/unsaved_changes_prompt/unsaved_changes_prompt.test.tsx b/packages/kbn-unsaved-changes-prompt/src/unsaved_changes_prompt/unsaved_changes_prompt.test.tsx index 3b8c38caeef5..5b155d657c48 100644 --- a/packages/kbn-unsaved-changes-prompt/src/unsaved_changes_prompt/unsaved_changes_prompt.test.tsx +++ b/packages/kbn-unsaved-changes-prompt/src/unsaved_changes_prompt/unsaved_changes_prompt.test.tsx @@ -8,7 +8,8 @@ */ import { createMemoryHistory } from 'history'; -import { renderHook, act, cleanup } from '@testing-library/react-hooks'; + +import { renderHook, act, cleanup, waitFor } from '@testing-library/react'; import { coreMock } from '@kbn/core/public/mocks'; import { CoreScopedHistory } from '@kbn/core/public'; @@ -73,7 +74,7 @@ describe('useUnsavedChangesPrompt', () => { act(() => history.push('/test')); // needed because we have an async useEffect - await act(() => new Promise((resolve) => resolve())); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(navigateToUrl).toBeCalledWith('/mock/test', expect.anything()); expect(coreStart.overlays.openConfirm).toBeCalled(); diff --git a/src/plugins/console/public/application/containers/editor/hooks/use_set_initial_value.test.ts b/src/plugins/console/public/application/containers/editor/hooks/use_set_initial_value.test.ts index 0605a0c903ee..4dab86712707 100644 --- a/src/plugins/console/public/application/containers/editor/hooks/use_set_initial_value.test.ts +++ b/src/plugins/console/public/application/containers/editor/hooks/use_set_initial_value.test.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import { useSetInitialValue } from './use_set_initial_value'; import { IToasts } from '@kbn/core-notifications-browser'; import { decompressFromEncodedURIComponent } from 'lz-string'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/component_template_datastreams_rollover/use_datastreams_rollover.test.tsx b/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/component_template_datastreams_rollover/use_datastreams_rollover.test.tsx index 903a9187a733..d4ac28521b31 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/component_template_datastreams_rollover/use_datastreams_rollover.test.tsx +++ b/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/component_template_datastreams_rollover/use_datastreams_rollover.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useComponentTemplatesContext } from '../../component_templates_context'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/use_step_from_query_string.test.tsx b/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/use_step_from_query_string.test.tsx index cb26f40c91ae..6e04cdc37e1f 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/use_step_from_query_string.test.tsx +++ b/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/use_step_from_query_string.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { createMemoryHistory } from 'history'; import { useStepFromQueryString } from './use_step_from_query_string'; diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/semantic_text/use_semantic_text.test.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/semantic_text/use_semantic_text.test.ts index 65415a287d94..15537b0335e0 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/semantic_text/use_semantic_text.test.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/semantic_text/use_semantic_text.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { CustomInferenceEndpointConfig, SemanticTextField } from '../../../../../types'; import { useSemanticText } from './use_semantic_text'; import { act } from 'react-dom/test-utils'; diff --git a/x-pack/plugins/index_management/public/application/hooks/redirect_path.test.tsx b/x-pack/plugins/index_management/public/application/hooks/redirect_path.test.tsx index 5b189ccbc253..83bd06a8dd49 100644 --- a/x-pack/plugins/index_management/public/application/hooks/redirect_path.test.tsx +++ b/x-pack/plugins/index_management/public/application/hooks/redirect_path.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { coreMock } from '@kbn/core/public/mocks'; import { createMemoryHistory } from 'history'; import { useRedirectPath } from './redirect_path'; diff --git a/x-pack/plugins/index_management/public/hooks/use_details_page_mappings_model_management.test.ts b/x-pack/plugins/index_management/public/hooks/use_details_page_mappings_model_management.test.ts index 62746791510c..4de34b584aec 100644 --- a/x-pack/plugins/index_management/public/hooks/use_details_page_mappings_model_management.test.ts +++ b/x-pack/plugins/index_management/public/hooks/use_details_page_mappings_model_management.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { NormalizedFields } from '../application/components/mappings_editor/types'; import { useDetailsPageMappingsModelManagement } from './use_details_page_mappings_model_management'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/hooks/redirect_path.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/hooks/redirect_path.test.tsx index a387661fc1b5..25729f5ba255 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/hooks/redirect_path.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/hooks/redirect_path.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { createMemoryHistory } from 'history'; import { useRedirectPath } from './redirect_path'; import { useKibana } from '../../shared_imports'; diff --git a/x-pack/plugins/snapshot_restore/public/application/components/collapsible_lists/use_collapsible_list.test.ts b/x-pack/plugins/snapshot_restore/public/application/components/collapsible_lists/use_collapsible_list.test.ts index 72bfa570df5c..dcc9fe1932f5 100644 --- a/x-pack/plugins/snapshot_restore/public/application/components/collapsible_lists/use_collapsible_list.test.ts +++ b/x-pack/plugins/snapshot_restore/public/application/components/collapsible_lists/use_collapsible_list.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useCollapsibleList } from './use_collapsible_list';