[Discover] Add sidebar jest test (#76286)
* Add Jest test removed in #73226
This commit is contained in:
parent
7c3ad238e5
commit
27bdc88011
1 changed files with 6 additions and 2 deletions
|
@ -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,
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue