From 408527809a5933763651abe543c4fb40bb33dab4 Mon Sep 17 00:00:00 2001 From: Marta Bondyra Date: Mon, 29 Mar 2021 16:35:58 +0200 Subject: [PATCH] [Lens] remove warnings when running tests (#95637) (#95648) --- .../lens/public/indexpattern_datasource/datapanel.test.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx index 669758c5193a6c..e6a38ce2bb7130 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx @@ -827,7 +827,7 @@ describe('IndexPattern Data Panel', () => { }); // wait for indx pattern to be loaded - await new Promise((r) => setTimeout(r, 0)); + await act(async () => await new Promise((r) => setTimeout(r, 0))); expect(props.indexPatternFieldEditor.openEditor).toHaveBeenCalledWith( expect.objectContaining({ @@ -860,10 +860,11 @@ describe('IndexPattern Data Panel', () => { .prop('children') as ReactElement).props.items[0].props.onClick(); }); // wait for indx pattern to be loaded - await new Promise((r) => setTimeout(r, 0)); + await act(async () => await new Promise((r) => setTimeout(r, 0))); + await (props.indexPatternFieldEditor.openEditor as jest.Mock).mock.calls[0][0].onSave(); // wait for indx pattern to be loaded - await new Promise((r) => setTimeout(r, 0)); + await act(async () => await new Promise((r) => setTimeout(r, 0))); expect(props.onUpdateIndexPattern).toHaveBeenCalledWith( expect.objectContaining({ fields: [