Skip to content

Commit

Permalink
[Discover][UnifiedDataTable] Fix flaky jest test
Browse files Browse the repository at this point in the history
Preventing a flaky jest test by adding waitFor functionality
  • Loading branch information
kertal authored Nov 28, 2024
1 parent d0d33aa commit d3727a5
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
stubLogstashDataView,
} from '@kbn/data-views-plugin/common/data_view.stub';
import { DataTableColumnHeader } from './data_table_column_header';
import { waitFor } from '@testing-library/react';

const stubDataViewWithNested = createStubDataView({
spec: {
Expand Down Expand Up @@ -71,7 +72,7 @@ describe('DataTableColumnHeader', function () {
/>
);
expect(component.find(FieldIcon).first().prop('type')).toBe('number');
expect(component.text()).toBe('NumberbytesDisplayName');
await waitFor(() => expect(component.text()).toBe('NumberbytesDisplayName'));
});

it('should render a correct token for a custom column type (in case of text-based queries)', async () => {
Expand Down

0 comments on commit d3727a5

Please sign in to comment.