You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Redux reducers are something that it's worth UTing since it's easy to write tests and they're a key piece of logic that is supposed to be very reliable.
We don't have any UTs yet, so we should write them for all our Redux slices. There's some demo Counter code with UTs that we can use as examples, then we can probably delete that demo code.
There isn't much logic yet, so it shouldn't take too long to write these UTs, then we can make writing them a requirement for all future features. This work includes doing some research to work out if it's possible to add UTs for async thunks, and our custom selectors in mapSlice.ts
The testing library
On the LX backend, we use Mocha as our testing library. It's apparently possible to use Mocha for this too, but I think we should just stick with Vitest + React Testing Library, as used in the demo code. This is what Redux provides documentation for, and it's a similar syntax to Mocha anyway https://redux.js.org/usage/writing-tests
The benefits of having more documentation and the library's React-specific functionality outweighs the benefit of using Mocha throughout all our codebases.
Acceptance Criteria
We have a full set of UTs for all our Redux reducers
The UTs are run automatically in a GitHub CI pipeline for all PRs and pushes to main
Probably after the review, so that we can write these UTs alongside UI changes that we make. It will be efficient to write UTs for areas of code that we're already looking at and needing to make sense of.
I think we also should do a general call to prioritise tech debt though, before getting stuck in to writing lots of UTs, since there might be more important things
Description
Redux reducers are something that it's worth UTing since it's easy to write tests and they're a key piece of logic that is supposed to be very reliable.
We don't have any UTs yet, so we should write them for all our Redux slices. There's some demo
Counter
code with UTs that we can use as examples, then we can probably delete that demo code.There isn't much logic yet, so it shouldn't take too long to write these UTs, then we can make writing them a requirement for all future features. This work includes doing some research to work out if it's possible to add UTs for async thunks, and our custom selectors in
mapSlice.ts
The testing library
On the LX backend, we use Mocha as our testing library. It's apparently possible to use Mocha for this too, but I think we should just stick with Vitest + React Testing Library, as used in the demo code. This is what Redux provides documentation for, and it's a similar syntax to Mocha anyway https://redux.js.org/usage/writing-tests
The benefits of having more documentation and the library's React-specific functionality outweighs the benefit of using Mocha throughout all our codebases.
Acceptance Criteria
main
The text was updated successfully, but these errors were encountered: