This is an automated email from the ASF dual-hosted git repository. ccwilliams pushed a commit to branch chris--ajax-charts in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
commit eade7f055d31af3fffe9910e05be72964f8f25ac Author: Chris Williams <[email protected]> AuthorDate: Wed Sep 12 13:29:27 2018 -0700 [tests] add fetch-mock dep and helpers/setupSupersetClient.js --- superset/assets/package.json | 1 + superset/assets/spec/helpers/setupSupersetClient.js | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/superset/assets/package.json b/superset/assets/package.json index 4ec55c2..5d64c38 100644 --- a/superset/assets/package.json +++ b/superset/assets/package.json @@ -161,6 +161,7 @@ "eslint-plugin-prettier": "^2.6.0", "eslint-plugin-react": "^7.0.1", "exports-loader": "^0.7.0", + "fetch-mock": "^7.0.0-alpha.6", "file-loader": "^1.1.11", "gl": "^4.0.4", "ignore-styles": "^5.0.1", diff --git a/superset/assets/spec/helpers/setupSupersetClient.js b/superset/assets/spec/helpers/setupSupersetClient.js new file mode 100644 index 0000000..dd6367c --- /dev/null +++ b/superset/assets/spec/helpers/setupSupersetClient.js @@ -0,0 +1,10 @@ +import fetchMock from 'fetch-mock'; +import { SupersetClient } from '@superset-ui/core'; + +export default function setupSupersetClient() { + // The following is needed to mock out SupersetClient requests + // including CSRF authentication and initialization + global.FormData = window.FormData; // used by SupersetClient + fetchMock.get('glob:*superset/csrf_token/*', { csrf_token: '1234' }); + SupersetClient.configure({ protocol: 'http', host: 'localhost' }).init(); +}
