Skip to content

Commit 27bdc88

Browse files
authored
[Discover] Add sidebar jest test (#76286)
* Add Jest test removed in #73226
1 parent 7c3ad23 commit 27bdc88

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/plugins/discover/public/application/components/sidebar/discover_field.test.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,10 @@ function getComponent(selected = false, showDetails = false, useShortDots = fals
8080
const props = {
8181
indexPattern,
8282
field,
83-
getDetails: jest.fn(),
83+
getDetails: jest.fn(() => ({ buckets: [], error: '', exists: 1, total: true, columns: [] })),
8484
onAddFilter: jest.fn(),
8585
onAddField: jest.fn(),
8686
onRemoveField: jest.fn(),
87-
onShowDetails: jest.fn(),
8887
showDetails,
8988
selected,
9089
useShortDots,
@@ -104,4 +103,9 @@ describe('discover sidebar field', function () {
104103
findTestSubject(comp, 'fieldToggle-bytes').simulate('click');
105104
expect(props.onRemoveField).toHaveBeenCalledWith('bytes');
106105
});
106+
it('should trigger getDetails', function () {
107+
const { comp, props } = getComponent(true);
108+
findTestSubject(comp, 'field-bytes-showDetails').simulate('click');
109+
expect(props.getDetails).toHaveBeenCalledWith(props.field);
110+
});
107111
});

0 commit comments

Comments
 (0)