mirror of
https://github.com/apache/superset.git
synced 2026-04-17 07:05:04 +00:00
[explore] Split large reducer logic in ExploreViewContainer (#3088)
* split reducer logic for ExploreViewContainer * fix saveModal component and unit tests * revert changes in SaveModal_spec. will make another commit just to improve test coverage for SaveModal component. * remove comment-out code * fix merge confilicts
This commit is contained in:
committed by
Maxime Beauchemin
parent
08b7e891a7
commit
b3107bb603
@@ -0,0 +1,36 @@
|
||||
import { it, describe } from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import sinon from 'sinon';
|
||||
import $ from 'jquery';
|
||||
import * as exploreUtils from '../../../javascripts/explore/exploreUtils';
|
||||
import * as actions from '../../../javascripts/explore/actions/chartActions';
|
||||
|
||||
describe('chart actions', () => {
|
||||
let dispatch;
|
||||
let urlStub;
|
||||
let ajaxStub;
|
||||
let request;
|
||||
|
||||
beforeEach(() => {
|
||||
dispatch = sinon.spy();
|
||||
urlStub = sinon.stub(exploreUtils, 'getExploreUrl').callsFake(() => ('mockURL'));
|
||||
ajaxStub = sinon.stub($, 'ajax');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
urlStub.restore();
|
||||
ajaxStub.restore();
|
||||
});
|
||||
|
||||
it('should handle query timeout', () => {
|
||||
ajaxStub.yieldsTo('error', { statusText: 'timeout' });
|
||||
request = actions.runQuery({});
|
||||
request(dispatch, sinon.stub().returns({
|
||||
explore: {
|
||||
controls: [],
|
||||
},
|
||||
}));
|
||||
expect(dispatch.callCount).to.equal(3);
|
||||
expect(dispatch.args[0][0].type).to.equal(actions.CHART_UPDATE_TIMEOUT);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user