feat: expand new chart data endpoint coverage (#9903)

* feat: implement new chart API for additional components

* Fix python tests

* Fix tests

* Fix lint

* fix camel case error in requestParams

* lint

* fix samples row limit

* Add samples row limit to config

* remove unnecessary code

* lint

* Address review comments
This commit is contained in:
Ville Brofeldt
2020-06-02 10:47:28 +03:00
committed by GitHub
parent c7618ee54b
commit 38a6bd79da
12 changed files with 196 additions and 126 deletions

View File

@@ -55,7 +55,13 @@ describe('chart actions', () => {
.callsFake(() => ({ get: () => fakeMetadata }));
buildQueryRegistryStub = sinon
.stub(chartlib, 'getChartBuildQueryRegistry')
.callsFake(() => ({ get: () => () => ({ some_param: 'fake query!' }) }));
.callsFake(() => ({
get: () => () => ({
some_param: 'fake query!',
result_type: 'full',
result_format: 'json',
}),
}));
});
afterEach(() => {
@@ -76,7 +82,11 @@ describe('chart actions', () => {
expect(fetchMock.calls(V1_URL)).toHaveLength(1);
expect(fetchMock.calls(V1_URL)[0][1].body).toBe(
JSON.stringify({ some_param: 'fake query!' }),
JSON.stringify({
some_param: 'fake query!',
result_type: 'full',
result_format: 'json',
}),
);
expect(dispatch.args[0][0].type).toBe(actions.CHART_UPDATE_STARTED);
});
@@ -153,6 +163,7 @@ describe('chart actions', () => {
return actionThunk(dispatch).then(() => {
// chart update, trigger query, update form data, fail
expect(fetchMock.calls(MOCK_URL)).toHaveLength(1);
expect(dispatch.callCount).toBe(5);
expect(dispatch.args[4][0].type).toBe(actions.CHART_UPDATE_TIMEOUT);
setupDefaultFetchMock();