DEV Community

Discussion on: Testing a Redux data store with Cypress.io

Collapse
 
keyboslice_44 profile image
Keir Lavelle

Nice to know about checking for the global Cypress and exposing parts of the application to the world based on that thanks, but I feel like these tests are brittle and testing the wrong thing.

We shouldn't really care if there's a isModalOpen flag in our store that is true, or if our array of contacts is a certain length - those are just implementation details, what we should care about is that the modal appears in the viewport in response to some interaction, or that the correct number of contact cards is displayed.

It's much more valuable to test the things that the store controls, not the store itself and you can also refactor more easily when you're testing the end result and not the implementation.

It's really useful to know how to expose the store to Cypress for the purposes of setting up the state for the test though, so thanks for that