-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SIP-4][superset-client] add SupersetClient
, refactor app
#5772
Changes from 6 commits
1653662
c7e2207
39c138a
01d2f7f
8b736a6
2573a54
7de2fda
c9fba49
1d05072
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ describe('sliceEntities reducer', () => { | |
it('should set slices', () => { | ||
const result = sliceEntitiesReducer( | ||
{ slices: { a: {} } }, | ||
{ type: SET_ALL_SLICES, slices: { 1: {}, 2: {} } }, | ||
{ type: SET_ALL_SLICES, payload: { slices: { 1: {}, 2: {} } } }, | ||
); | ||
|
||
expect(result.slices).to.deep.equal({ | ||
|
@@ -42,7 +42,7 @@ describe('sliceEntities reducer', () => { | |
{}, | ||
{ | ||
type: FETCH_ALL_SLICES_FAILED, | ||
error: { responseJSON: { message: 'errorrr' } }, | ||
error: 'errorrr', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a test / misspelling was purposeful. |
||
}, | ||
); | ||
expect(result.isLoading).to.equal(false); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ import { expect } from 'chai'; | |
import { describe, it, beforeEach } from 'mocha'; | ||
import { shallow } from 'enzyme'; | ||
import configureStore from 'redux-mock-store'; | ||
import $ from 'jquery'; | ||
import sinon from 'sinon'; | ||
import fetchMock from 'fetch-mock'; | ||
import thunk from 'redux-thunk'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :) love thunk |
||
|
||
import DatasourceEditor from '../../../src/datasource/DatasourceEditor'; | ||
import mockDatasource from '../../fixtures/mockDatasource'; | ||
|
@@ -14,8 +14,9 @@ const props = { | |
datasource: mockDatasource['7__table'], | ||
addSuccessToast: () => {}, | ||
addDangerToast: () => {}, | ||
onChange: sinon.spy(), | ||
onChange: () => {}, | ||
}; | ||
|
||
const extraColumn = { | ||
column_name: 'new_column', | ||
type: 'VARCHAR(10)', | ||
|
@@ -27,26 +28,23 @@ const extraColumn = { | |
groupby: true, | ||
}; | ||
|
||
const endpoint = 'glob:*/datasource/external_metadata/*'; | ||
|
||
describe('DatasourceEditor', () => { | ||
const mockStore = configureStore([]); | ||
const mockStore = configureStore([thunk]); | ||
const store = mockStore({}); | ||
fetchMock.get(endpoint, []); | ||
|
||
let wrapper; | ||
let el; | ||
let ajaxStub; | ||
let inst; | ||
|
||
beforeEach(() => { | ||
ajaxStub = sinon.stub($, 'ajax'); | ||
el = <DatasourceEditor {...props} />; | ||
wrapper = shallow(el, { context: { store } }).dive(); | ||
inst = wrapper.instance(); | ||
}); | ||
|
||
afterEach(() => { | ||
ajaxStub.restore(); | ||
}); | ||
|
||
it('is valid', () => { | ||
expect(React.isValidElement(el)).to.equal(true); | ||
}); | ||
|
@@ -55,12 +53,17 @@ describe('DatasourceEditor', () => { | |
expect(wrapper.find(Tabs)).to.have.lengthOf(1); | ||
}); | ||
|
||
it('makes an async request', () => { | ||
it('makes an async request', (done) => { | ||
wrapper.setState({ activeTabKey: 2 }); | ||
const syncButton = wrapper.find('.sync-from-source'); | ||
expect(syncButton).to.have.lengthOf(1); | ||
syncButton.simulate('click'); | ||
expect(ajaxStub.calledOnce).to.equal(true); | ||
|
||
setTimeout(() => { | ||
expect(fetchMock.calls(endpoint)).to.have.lengthOf(1); | ||
fetchMock.reset(); | ||
done(); | ||
}, 0); | ||
}); | ||
|
||
it('merges columns', () => { | ||
|
@@ -69,5 +72,4 @@ describe('DatasourceEditor', () => { | |
inst.mergeColumns([extraColumn]); | ||
expect(inst.state.databaseColumns.length).to.equal(numCols + 1); | ||
}); | ||
|
||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning for this, turning this off is BAD!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one total worths its own PR.