4 ms·
> unit test anything but the individual pieces Isn't that the definition of a unit test?
by lucasmullens 7y ago
> unit test anything but the individual pieces
Isn't that the definition of a unit test?
- ellius 7y agoDebatable but I get your point. The thing is that Flux is a pattern, and you often want to test the full pattern to get a meaningful "unit" of behavior/logic. There can be meaningful logic in the individual pieces, but frequently they only make sense as a whole.
- onesmalldrop 7y agoIt's not debatable... Unit tests are for testing individual components of your application (web or otherwise) e2e or integration tests are for testing your application component/lib/api/whatever boundaries
- ellius 7y agoSure, but what do you count as a "component"? It varies by language, framework, platform, and pattern.
- nohuhu 7y agoHow do you test individual components in isolation if they depend on the global state store?
- root_axis 7y agoThat's a code smell. 99% of components in a project should rely on props.
- nohuhu 7y agoHow does that play with Redux Hooks for example? https://react-redux.js.org/next/api/hooks https://react-redux.js.org/next/api/hooks If you are using hooks in your components, you need the global store instance. To call this unit testing is too big a stretch for me.