sadpandajoe opened a new pull request, #44841:
URL: https://github.com/apache/superset/pull/44841

   ### SUMMARY
   Adds unit tests for `fetchTopNValues` and `extractDimensionValues`. The 
component test for the Matrixify dimension control mocks this module entirely, 
so none of its real code ran under test.
   
   The new tests mock `getChartDataRequest` and cover:
   - The chart-data query it builds: `groupby`, `metrics`, `row_limit`, 
`orderby` (descending by default, ascending when requested), `adhoc_filters`, 
`time_range`, and `viz_type: 'table'`.
   - Mapping result rows to `{ value, metricValue }`.
   - Returning `[]` when the response has no `json`, `result`, or `data`.
   - Logging and re-throwing when the request rejects.
   - `extractDimensionValues` returning only the values.
   
   Test-only change; no production code is modified.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A
   
   ### TESTING INSTRUCTIONS
   ```
   cd superset-frontend
   npx jest 
src/explore/components/controls/MatrixifyControl/utils/fetchTopNValues.test.ts
   ```
   Also confirmed the tests fail when the sort direction is flipped, the error 
is swallowed, the value/metric mapping is swapped, or the no-data guard is 
removed.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to