forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 1
/
scaling_form.test.tsx
53 lines (42 loc) · 1.48 KB
/
scaling_form.test.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
jest.mock('../../../kibana_services', () => ({}));
jest.mock('./load_index_settings', () => ({
loadIndexSettings: async () => {
return { maxInnerResultWindow: 100, maxResultWindow: 10000 };
},
}));
import React from 'react';
import { shallow } from 'enzyme';
import { ScalingForm } from './scaling_form';
import { SCALING_TYPES } from '../../../../common/constants';
const defaultProps = {
filterByMapBounds: true,
indexPatternId: 'myIndexPattern',
onChange: () => {},
scalingType: SCALING_TYPES.LIMIT,
supportsClustering: true,
termFields: [],
topHitsSize: 1,
};
test('should render', async () => {
const component = shallow(<ScalingForm {...defaultProps} />);
expect(component).toMatchSnapshot();
});
test('should disable clusters option when clustering is not supported', async () => {
const component = shallow(
<ScalingForm
{...defaultProps}
supportsClustering={false}
clusteringDisabledReason="Simulated clustering disabled"
/>
);
expect(component).toMatchSnapshot();
});
test('should render top hits form when scaling type is TOP_HITS', async () => {
const component = shallow(<ScalingForm {...defaultProps} scalingType={SCALING_TYPES.TOP_HITS} />);
expect(component).toMatchSnapshot();
});