[Lens] remove warnings when running tests (#95637)

This commit is contained in:
Marta Bondyra 2021-03-29 14:25:08 +02:00 committed by GitHub
parent e4e4a01298
commit a1748cb3a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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: [