From 802012385d626f063a4bee4aac1672789a25455b Mon Sep 17 00:00:00 2001 From: Timur Olzhabayev Date: Fri, 26 Jan 2024 09:51:15 +0100 Subject: [PATCH] Chore: fixing PanelDataTransformationsTab Test (#81329) * fixing An update to Input inside a test was not wrapped in act(...). * no need to await twice * looks like we do need to await twice --- .../PanelDataTransformationsTab.test.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataTransformationsTab.test.tsx b/public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataTransformationsTab.test.tsx index fd6af7a8aa0..f975f7256a8 100644 --- a/public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataTransformationsTab.test.tsx +++ b/public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataTransformationsTab.test.tsx @@ -102,8 +102,9 @@ describe('PanelDataTransformationsTab', () => { selectors.components.TransformTab.newTransform('Add field from calculation') ); const button = transformationCard.getElementsByTagName('button').item(0); - - await userEvent.click(button!); + await act(async () => { + await userEvent.click(button!); + }); expect(onChangeTransformation).toHaveBeenCalledWith([{ id: 'calculateField', options: {} }]); }); @@ -129,9 +130,9 @@ describe('PanelDataTransformationsTab', () => { selectors.components.TransformTab.newTransform('Add field from calculation') ); const button = transformationCard.getElementsByTagName('button').item(0); - - await userEvent.click(button!); - + await act(async () => { + await userEvent.click(button!); + }); expect(onChangeTransformation).toHaveBeenCalledWith([ { id: 'calculateField', options: {} }, { id: 'calculateField', options: {} },