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
The first thing that should be done is improving the tests base, making it more resilient.
Currently, the project only has unit tests, and specially for UI components, they are fragile and hard to maintain, and the value they add is limited. It's easy to break a test by changing some behavior that does not really imply a change for end-users.
I think that the project needs some kind of test where the app is run in a headless browser, in order to test the UI, and this would allow replacing the unit tests for components.
For some cases, we can even take snapshots (in the sense of actual screenshots of what's displayed), and just verify that what's actually rendered matches them.
We could even consider having the same tests pass for different screen resolutions.
However, there's a lot of dependency-less business logic outside of components for which we can keep unit tests.
Remove dependency injection container
A while ago I added DI to the project, by using a dependency injection container.
It has provided some benefits, but due to the way react and redux work, it has also become the source of many problems.
It was mainly added to ease unit testing stuff, but if previous point is properly done, that would no longer be a problem.
For the few cases in which we still have a bit of coupling, jest's mechanism to mock imports can be used. It's ugly, but it's probably the least of two evils.
The project is starting to suffer a bit of tech debt, and there are a few things that can be done to solve it.
Improve tests
The first thing that should be done is improving the tests base, making it more resilient.
Currently, the project only has unit tests, and specially for UI components, they are fragile and hard to maintain, and the value they add is limited. It's easy to break a test by changing some behavior that does not really imply a change for end-users.
I think that the project needs some kind of test where the app is run in a headless browser, in order to test the UI, and this would allow replacing the unit tests for components.
For some cases, we can even take snapshots (in the sense of actual screenshots of what's displayed), and just verify that what's actually rendered matches them.
We could even consider having the same tests pass for different screen resolutions.
However, there's a lot of dependency-less business logic outside of components for which we can keep unit tests.
Remove dependency injection container
A while ago I added DI to the project, by using a dependency injection container.
It has provided some benefits, but due to the way react and redux work, it has also become the source of many problems.
It was mainly added to ease unit testing stuff, but if previous point is properly done, that would no longer be a problem.
For the few cases in which we still have a bit of coupling, jest's mechanism to mock imports can be used. It's ugly, but it's probably the least of two evils.
Migrate to typescriptDone!The project needs strict types desperatelly. The project should be migrated to typescript ASAP.
The text was updated successfully, but these errors were encountered: