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
Jest has become the pretty clear favorite for testing the kind of JavaScript application that Popcode is. I’ve never been amazingly happy with tape anyway, so let’s switch to the framework that will be most familiar to contributors.
Also, the new tests should avoid repeating the mistakes I made in structuring the old test suite. Specifically:
The reducer tests use the reducerTest helper function, which takes a before-state, an action, and an expected after-state. This however does not match the way one naturally thinks about testing reducers, namely: start with this state; apply this action; then make specific assertions about the resulting state (rather than just saying “this is what the resulting state should be”).
Reusable test helpers, particularly for creating test data, are unintuitive and not well-structured. We should have factory modules for each category of object we’d like to create: e.g., one for objects that the Firebase SDK would give us; one for objects that the GitHub API would give us; etc. We should use something like rosie to make factories simple to build and easy to extend.
Test code should not do direct manipulation on Redux state data structures. Redux state used in tests should always be generated by running a series of actions through the reducers. We should have a helper module to make this boilerplate-free.
Tests to migrate
Reducers
clients
compiledProjects
console
currentProject
errors
googleClassroom
index
projects
resizableFlex
ui
user
Sagas
Test should be ported as part of migration to redux-logic.
Validations
Validation tests will likely involve no major changes other than moving from Tape to Jest. So it might be worth exploring the use of a codemod to do this automatically.
Jest has become the pretty clear favorite for testing the kind of JavaScript application that Popcode is. I’ve never been amazingly happy with tape anyway, so let’s switch to the framework that will be most familiar to contributors.
Also, the new tests should avoid repeating the mistakes I made in structuring the old test suite. Specifically:
reducerTest
helper function, which takes a before-state, an action, and an expected after-state. This however does not match the way one naturally thinks about testing reducers, namely: start with this state; apply this action; then make specific assertions about the resulting state (rather than just saying “this is what the resulting state should be”).rosie
to make factories simple to build and easy to extend.Tests to migrate
Reducers
clients
compiledProjects
console
currentProject
errors
googleClassroom
index
projects
resizableFlex
ui
user
Sagas
Test should be ported as part of migration to
redux-logic
.Validations
Validation tests will likely involve no major changes other than moving from Tape to Jest. So it might be worth exploring the use of a codemod to do this automatically.
html
css
javascript
Miscellaneous
Other Tape tests that can be found in
test/unit
:higherOrderComponents/resizableFlex/calculateFlexGrowAfterDrag
localization/localization
Analyzer
util/javascript
util/queryParams
The text was updated successfully, but these errors were encountered: