Add render test helper to follow suggested Redux testing practices by zetter-rpf · Pull Request #1392 · RaspberryPiFoundation/editor-ui

and others added 5 commits

March 18, 2026 11:19
Extract a shared render helper for the mock Redux store and Provider wiring. This removes repetitive setup from each test case so scenarios focus on state differences instead of store plumbing, which aligns with Redux testing guidance to keep tests maintainable.

Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Replace redux-mock-store with configureStore + root reducer so tests exercise real reducer behavior, matching Redux's recommended integration testing pattern. Assertions now verify observable store state changes instead of mocked dispatched-action arrays, which reduces false confidence and avoids mock-store deprecation warnings.

Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Create a reusable Redux-aware render helper so component tests can share one Provider/store setup pattern. Updating SaveButton to use this keeps Redux test wiring consistent with the recommended real-store approach while reducing per-test boilerplate and making future migrations easier.

Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Remove the local renderSaveButton wrapper and call renderWithProviders directly in each setup block. This keeps the test aligned to the shared utility API, avoids an extra indirection layer, and makes the common pattern easier to copy into other Redux-connected tests.

Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Use preloadedState naming and object shorthand when calling renderWithProviders. This matches Redux Toolkit terminology and removes repetitive key:value syntax, making each setup block clearer and more consistent.

Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>

@cursoragent @zetter-rpf

Remove unused store bindings in scenarios that only verify rendered button classes. This resolves no-unused-vars warnings from yarn lint and keeps the setup focused on the behavior each test actually asserts.

Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>

@zetter-rpf zetter-rpf changed the title Improve SaveButton Redux tests with modern store patterns Add render test helper to follow suggested Redux testing practices

Mar 19, 2026

Copilot AI review requested due to automatic review settings

March 19, 2026 09:37

zetter-rpf