Repository navigation
test(chart): URL params land on each query in chart-data request - #40913
Conversation
Ports the deprecated Cypress dashboard spec _skip.url_params.test.ts (removed in #40384) to a Jest integration test with a mocked network. The request-construction contract — that form_data.url_params lands on each query in the /api/v1/chart/data request body — is verifiable without a backend. The new test drives getChartDataRequest through the real buildV1ChartDataPayload → buildQueryContext → buildQueryObject path and asserts the intercepted POST body's queries[].url_params and form_data. A third case pins the existing default of {} when url_params is absent so a future change to that default fails loudly. Part of the Cypress→Jest/Playwright migration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a Jest integration test in the Superset frontend to lock in the request-construction contract that form_data.url_params is forwarded onto every query (queries[].url_params) in /api/v1/chart/data POST bodies. This supports the ongoing Cypress → Jest/Playwright migration by porting coverage from a deprecated Cypress dashboard spec into a mocked-network test that exercises the real payload-building pipeline.
Changes:
- Introduces
urlParamsForwarding.integration.test.tsto asserturl_paramsappears on everyqueries[]entry when provided inform_data. - Adds an assertion that
form_data.url_paramsis preserved in the echoedform_datawithin the request body. - Pins the current default behavior that missing
url_paramsresults in{}on each query (notundefined) to prevent silent wire-shape changes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #40913 +/- ##
=======================================
Coverage 64.14% 64.14%
=======================================
Files 2653 2653
Lines 143525 143525
Branches 33120 33120
=======================================
+ Hits 92063 92070 +7
+ Misses 49851 49844 -7
Partials 1611 1611
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #36ced0Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
SUMMARY
Ports the deprecated Cypress dashboard spec
_skip.url_params.test.ts(removed in #40384) to a Jest integration test with a mocked network.
The request-construction contract — that
form_data.url_paramsisforwarded onto every query in the
/api/v1/chart/datarequest body —is verifiable without a backend. The new test drives
getChartDataRequestthrough the realbuildV1ChartDataPayload→buildQueryContext→buildQueryObjectpath (no stubs) and asserts the intercepted POST body's
queries[].url_paramsandform_data.url_params. A third case pinsthe existing default of
{}whenurl_paramsis absent, so a futurechange to that default fails loudly rather than silently changing the
wire shape.
The URL-string →
form_data.url_paramshop (handled byextractUrlParamsin
src/dashboard/actions/hydrate.ts) is intentionally out of scope hereand is covered by its own unit tests.
Part of the Cypress → Jest/Playwright migration.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — test-only change.
TESTING INSTRUCTIONS
From `superset-frontend/`:
```bash
npm run test -- src/components/Chart/urlParamsForwarding.integration.test.ts
```
Expected: 3 tests pass.
ADDITIONAL INFORMATION