From af3ed7bfe95e979b72144bf185d24bb8208b63a3 Mon Sep 17 00:00:00 2001 From: Jatin Kathuria Date: Tue, 25 Apr 2023 19:56:57 +0200 Subject: [PATCH] [Security Solution] [Fix] Conflicting PRs caused `check types` to fail on main,, (#155746) ## Summary [This build ](https://buildkite.com/elastic/kibana-on-merge/builds/29366#0187b90f-c56a-428c-932e-952e86d51bc6) was failing after the [PR - [Security solution] Mocks and Unit tests for Alert Page controls #155508](https://github.com/elastic/kibana/pull/155508) was merged on main. This happened because in between CI passed all checks and PR was merged, there was another PR merge which had some conflicting type. It caused CI to break on main. --- .../filter_group/filter_group.test.tsx | 25 +++++++++++-------- .../common/components/filter_group/index.tsx | 4 ++- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/components/filter_group/filter_group.test.tsx b/x-pack/plugins/security_solution/public/common/components/filter_group/filter_group.test.tsx index bdb01d2ad7e79..f066b022af04e 100644 --- a/x-pack/plugins/security_solution/public/common/components/filter_group/filter_group.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/filter_group/filter_group.test.tsx @@ -225,13 +225,14 @@ describe(' Filter Group Component ', () => { it('should call controlGroupTransform which returns object WITHOUT placeholder when type != OPTION_LIST_CONTROL on opening Flyout', async () => { const returnValueWatcher = jest.fn(); - controlGroupMock.openAddDataControlFlyout.mockImplementationOnce((fn) => { - if (fn) { - const returnValue = fn({}, 'NOT_OPTIONS_LIST_CONTROL'); - returnValueWatcher(returnValue); + controlGroupMock.openAddDataControlFlyout.mockImplementationOnce( + ({ controlInputTransform }) => { + if (controlInputTransform) { + const returnValue = controlInputTransform({}, 'NOT_OPTIONS_LIST_CONTROL'); + returnValueWatcher(returnValue); + } } - }); - + ); render(); // delete some panels const newInputData = { @@ -261,12 +262,14 @@ describe(' Filter Group Component ', () => { it('should call controlGroupTransform which returns object WITH correct placeholder value when type = OPTION_LIST_CONTROL on opening Flyout', async () => { const returnValueWatcher = jest.fn(); - controlGroupMock.openAddDataControlFlyout.mockImplementationOnce((fn) => { - if (fn) { - const returnValue = fn({}, OPTIONS_LIST_CONTROL); - returnValueWatcher(returnValue); + controlGroupMock.openAddDataControlFlyout.mockImplementationOnce( + ({ controlInputTransform }) => { + if (controlInputTransform) { + const returnValue = controlInputTransform({}, OPTIONS_LIST_CONTROL); + returnValueWatcher(returnValue); + } } - }); + ); render(); // delete some panels diff --git a/x-pack/plugins/security_solution/public/common/components/filter_group/index.tsx b/x-pack/plugins/security_solution/public/common/components/filter_group/index.tsx index 7f4c36090075a..533bf19146dad 100644 --- a/x-pack/plugins/security_solution/public/common/components/filter_group/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/filter_group/index.tsx @@ -399,7 +399,9 @@ const FilterGroupComponent = (props: PropsWithChildren) => { }; const addControlsHandler = useCallback(() => { - controlGroup?.openAddDataControlFlyout(newControlInputTranform); + controlGroup?.openAddDataControlFlyout({ + controlInputTransform: newControlInputTranform, + }); }, [controlGroup]); return (