Skip to content

Commit

Permalink
[Discover] Add sidebar jest test (#76286)
Browse files Browse the repository at this point in the history
* Add Jest test removed in #73226
  • Loading branch information
kertal authored Sep 1, 2020
1 parent 7c3ad23 commit 27bdc88
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,10 @@ function getComponent(selected = false, showDetails = false, useShortDots = fals
const props = {
indexPattern,
field,
getDetails: jest.fn(),
getDetails: jest.fn(() => ({ buckets: [], error: '', exists: 1, total: true, columns: [] })),
onAddFilter: jest.fn(),
onAddField: jest.fn(),
onRemoveField: jest.fn(),
onShowDetails: jest.fn(),
showDetails,
selected,
useShortDots,
Expand All @@ -104,4 +103,9 @@ describe('discover sidebar field', function () {
findTestSubject(comp, 'fieldToggle-bytes').simulate('click');
expect(props.onRemoveField).toHaveBeenCalledWith('bytes');
});
it('should trigger getDetails', function () {
const { comp, props } = getComponent(true);
findTestSubject(comp, 'field-bytes-showDetails').simulate('click');
expect(props.getDetails).toHaveBeenCalledWith(props.field);
});
});

0 comments on commit 27bdc88

Please sign in to comment.