From f4ff699a82253b036f51367da2e09dc04483b60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georgiana-Andreea=20Onolea=C8=9B=C4=83?= Date: Wed, 22 Jan 2025 16:48:32 +0200 Subject: [PATCH] [ResponseOps][Cases]Fix unit tests for React@18 (#207072) Closes https://github.com/elastic/kibana/issues/206954 ## Summary - fixed - [[job]](https://buildkite.com/elastic/kibana-pull-request/builds/267663#01946e9c-d647-4af9-9e61-586deed1bcfb) [[logs]](https://buildkite.com/organizations/elastic/pipelines/kibana-pull-request/builds/267663/jobs/01946e9c-d647-4af9-9e61-586deed1bcfb/artifacts/01946ec2-e5bc-40be-98f8-d9fec8226ede) Jest Tests / ConnectorForm calls onChange when the form is invalid --- .../connector_form.test.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/x-pack/platform/plugins/shared/triggers_actions_ui/public/application/sections/action_connector_form/connector_form.test.tsx b/x-pack/platform/plugins/shared/triggers_actions_ui/public/application/sections/action_connector_form/connector_form.test.tsx index cf12e2ce38af4..0883f477066c6 100644 --- a/x-pack/platform/plugins/shared/triggers_actions_ui/public/application/sections/action_connector_form/connector_form.test.tsx +++ b/x-pack/platform/plugins/shared/triggers_actions_ui/public/application/sections/action_connector_form/connector_form.test.tsx @@ -102,21 +102,21 @@ describe('ConnectorForm', () => { /> ); - expect(result.getByTestId('nameInput')).toBeInTheDocument(); + expect(await result.findByTestId('nameInput')).toBeInTheDocument(); await act(async () => { const submit = onChange.mock.calls[0][0].submit; await submit(); }); - await waitFor(() => expect(onChange).toHaveBeenCalled()); - - expect(onChange).toHaveBeenCalledWith({ - isSubmitted: false, - isSubmitting: false, - isValid: false, - preSubmitValidator: expect.anything(), - submit: expect.anything(), + await waitFor(() => { + expect(onChange).toHaveBeenCalledWith({ + isSubmitted: true, + isSubmitting: false, + isValid: false, + preSubmitValidator: expect.anything(), + submit: expect.anything(), + }); }); });