Skip to content

Commit

Permalink
fix flaky unit test (#81466) (#81496)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Oct 22, 2020
1 parent 90dc176 commit 57c31e8
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { IBasePath } from '../../../../../../src/core/public';
import { AttributeService } from '../../../../../../src/plugins/embeddable/public';
import { LensAttributeService } from '../../lens_attribute_service';
import { OnSaveProps } from '../../../../../../src/plugins/saved_objects/public/save_modal';
import { act } from 'react-dom/test-utils';

jest.mock('../../../../../../src/plugins/inspector/public/', () => ({
isAvailable: false,
Expand Down Expand Up @@ -337,10 +338,12 @@ describe('embeddable', () => {
} as LensEmbeddableInput);
embeddable.render(mountpoint);

embeddable.updateInput({
timeRange,
query,
filters: [{ meta: { alias: 'test', negate: true, disabled: true } }],
act(() => {
embeddable.updateInput({
timeRange,
query,
filters: [{ meta: { alias: 'test', negate: true, disabled: true } }],
});
});

expect(expressionRenderer).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -384,7 +387,9 @@ describe('embeddable', () => {
} as LensEmbeddableInput);
embeddable.render(mountpoint);

autoRefreshFetchSubject.next();
act(() => {
autoRefreshFetchSubject.next();
});

expect(expressionRenderer).toHaveBeenCalledTimes(2);
});
Expand Down

0 comments on commit 57c31e8

Please sign in to comment.