sadpandajoe opened a new pull request, #44840:
URL: https://github.com/apache/superset/pull/44840
### SUMMARY
Adds a direct unit test for `datasourcesReducer`. Only `SET_DATASOURCE` was
exercised before, indirectly through an action test; the `HYDRATE_EXPLORE` path
and the undefined-state default were untested.
The new tests cover:
- `SET_DATASOURCE` adds or replaces the entry keyed by `getDatasourceUid`
(including the id/type fallback when `uid` is missing) without dropping other
entries or mutating the previous state.
- `HYDRATE_EXPLORE` replaces the whole map with the payload's datasources,
removing old entries, and resets to `{}` when the payload has none.
- Undefined state with an unknown action returns `{}`; a defined state is
returned by reference.
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/reducers/datasourcesReducer.test.ts
```
Also confirmed the tests fail when `HYDRATE_EXPLORE` merges instead of
replacing, when `SET_DATASOURCE` drops existing entries, or when the
undefined-state default 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]