fix: optimize mapStateToProps for chart controls (#10264)

This commit is contained in:
Jesse Yang
2020-07-09 00:33:48 -07:00
committed by GitHub
parent 8d9bb5f472
commit e94c9804a2
6 changed files with 63 additions and 28 deletions

View File

@@ -27,6 +27,7 @@ import {
getFormDataFromControls,
applyMapStateToPropsToControl,
getAllControlsState,
getControlsState,
} from 'src/explore/controlUtils';
describe('controlUtils', () => {
@@ -246,6 +247,14 @@ describe('controlUtils', () => {
const control = getControlState('metrics', 'table', stateWithCount);
expect(control.default).toEqual(['count']);
});
it('should not apply mapStateToProps when initializing', () => {
const control = getControlState('metrics', 'table', {
...state,
isInitializing: true,
});
expect(control.default).toEqual(null);
});
});
describe('validateControl', () => {

View File

@@ -199,7 +199,6 @@ describe('ExploreResultsButton', () => {
const calls = fetchMock.calls(visualizeEndpoint);
expect(calls).toHaveLength(1);
const formData = calls[0][1].body;
Object.keys(mockOptions).forEach(key => {
// eslint-disable-next-line no-unused-expressions
expect(formData.get(key)).toBeDefined();