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
refactor: simplify getExploreUrl functions #9831
refactor: simplify getExploreUrl functions #9831
Conversation
expect(payload).toEqual(formData); | ||
}); | ||
it('generate proper saveas slice url', () => { | ||
const { url, payload } = getExploreUrlAndPayload({ | ||
formData, | ||
endpointType: 'json', | ||
force: false, | ||
curUrl: 'superset.com?foo=bar', | ||
}); | ||
compareURI( | ||
URI(url), | ||
URI('/superset/explore_json/').search({ foo: 'bar' }), | ||
); | ||
expect(payload).toEqual(formData); |
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 was an identical copy of the test case above.
Codecov Report
@@ Coverage Diff @@
## master #9831 +/- ##
==========================================
- Coverage 71.02% 70.79% -0.24%
==========================================
Files 586 184 -402
Lines 30635 17868 -12767
Branches 3151 0 -3151
==========================================
- Hits 21759 12649 -9110
+ Misses 8765 5219 -3546
+ Partials 111 0 -111
Continue to review full report at Codecov.
|
eeafad4
to
a53d7ec
Compare
a53d7ec
to
4e02f4e
Compare
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.
LGTM!
* remove payload from return signature * Rename function and fix tests * Lint * fix tests * Move useLegacyApi inquiry to exploreUtils
SUMMARY
The
getExploreUrlAndPayload
function is currently unnecessarily complex and returns an unmutated copy of one of its inputs (formData
). Also, thegetURIDirectory
signature includedformData
which was never used. This PR simplifies the function signatures with the ultimate aim of breaking up the functions into smaller more specific functions.TEST PLAN
Local testing + CI
ADDITIONAL INFORMATION