Modernize category modal and improve subcategory management#23583
Modernize category modal and improve subcategory management#23583Pickysaurus wants to merge 14 commits into
Conversation
Switch to new style modal. Added creation of new subcategories
IDCs
left a comment
There was a problem hiding this comment.
Hey @Pickysaurus, we're really thankful you're trying to help us out and modernising existing functionality.
One thing we've been pushing for during Vortex 2.x modernisation is unit-tests - Vortex is an intertwined headache and we just can't guarantee that changes to one component don't break something else, and we simply do not have the time to manually test every bit of code manually.
This PR may work just fine right now (haven't tested it yet, need to reserve a time slot); but can break 2 weeks down the road due to some change we made somewhere else.
For this reason, I don't think any of us app devs feel comfortable to merge this in without added unit-tests.
|
Could you give an example of a part of the app with good unit tests so I can see what you're looking for? All the existing tests within the module still pass (relating to the redux state), but I couldn't find any other tests in the area of the codebase I looked at as a reference for the standard you'd want |
|
First of all have a look at For this PR the one I'd really like covered is buildCategoryTree - it's recursive and easy to break.
Have a look at TL;DR: the bar is "cover the pure logic you extracted" and optionally lean on the Modal.test.tsx style if you want to render-test any of the smaller pieces. Also - if you find it hard to test something because vitest is pulling transient dependencies - it might be helpful to extract further (but I don't think it's the case here) |
All key logic should be tested.
|
I've added tests to the areas you suggested, and to some of the React components. Is that suitable? |
N.B. I did start writing tests for the hooks, too but the version of the test library Vortex uses doesn't seem to have |
|
PR feedback from @IDCs and Claude Code: Correctness issues
Conventions & style
Tests
|
- Add i18n (translation) support to category management hooks and views - Extract tree flattening logic into reusable `flattenTreeToIDs` utility with tests - Fix filename typos: CateogryTreeSelectionHook → CategoryTreeSelectionHook, CategroyTreeStateHook → CategoryTreeStateHook - Fix optional chaining bug in category reducer - Fix sort order logic and validation thresholds - Clean up unused imports and functions - Update test expectations to match new i18n string formats
I couldn't seem to get i18n count interpolation working but everything else on the list is fixed. |
This PR replaces the old categories modal with a new version built on the latest components.
Changes for the user
Technical Changes
Nexusclass, but I couldn't figure that out)