Skip to content

Commit

Permalink
[explore] Split large reducer logic in ExploreViewContainer (apache#3088
Browse files Browse the repository at this point in the history
)

* 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
  • Loading branch information
Grace Guo committed Aug 10, 2017
1 parent 3d78940 commit 707ee37
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions superset/assets/spec/javascripts/explore/exploreActions_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,42 +80,4 @@ describe('fetching actions', () => {
expect(dispatch.getCall(4).args[0].type).to.equal(actions.TRIGGER_QUERY);
});
});

describe('fetchDatasources', () => {
const makeRequest = () => {
request = actions.fetchDatasources();
request(dispatch);
};

it('calls fetchDatasourcesStarted', () => {
makeRequest();
expect(dispatch.args[0][0].type).to.equal(actions.FETCH_DATASOURCES_STARTED);
});

it('makes the ajax request', () => {
makeRequest();
expect(ajaxStub.calledOnce).to.be.true;
});

it('calls correct url', () => {
const url = '/superset/datasources/';
makeRequest();
expect(ajaxStub.getCall(0).args[0].url).to.equal(url);
});

it('calls correct actions on error', () => {
ajaxStub.yieldsTo('error', { responseJSON: { error: 'error text' } });
makeRequest();
expect(dispatch.callCount).to.equal(2);
expect(dispatch.getCall(1).args[0].type).to.equal(actions.FETCH_DATASOURCES_FAILED);
});

it('calls correct actions on success', () => {
ajaxStub.yieldsTo('success', { data: '' });
makeRequest();
expect(dispatch.callCount).to.equal(3);
expect(dispatch.getCall(1).args[0].type).to.equal(actions.SET_DATASOURCES);
expect(dispatch.getCall(2).args[0].type).to.equal(actions.FETCH_DATASOURCES_SUCCEEDED);
});
});
});

0 comments on commit 707ee37

Please sign in to comment.