Comments (3)
It depends on what behavior you would like to test.
from ama.
When I implement a module something like api middleware in redux real world example, I found I don't really know how to well test it. Then I split it into middleware, api utils, schemas three files and try to follow single responsibility principle.
Maybe I Just want to avoid introducing some stupid bugs when I modified some code. I usually mock third party libraries in unit tests and then test they have been called correctly, but it seems cumbersome when a lot of .then
call. Hope to hear some your advice or your past experience here.
from ama.
I'd just mock fetch
and verify that different API responses handled in different order produce a state that makes sense. If I needed to test something more specific, I'd split the function and test its parts separately.
from ama.
Related Issues (20)
- What are the most popular IDEs among React developers at Facebook?
- Which product metrics does React have?
- What skills have made the biggest impact on your programming?
- Google Analytics && extending setState in the class
- React-Native support in 2018 later
- CRA + Monorepo + Lerna + Yarn HOT 3
- Help me to find a right way HOT 2
- Curious what keyboard and mouse you use
- react-testing-library Integration Tests HOT 1
- What Computer Science concepts do you know?
- How did you get a UK Work Visa without a degree.
- What does "gaeron" mean? HOT 2
- Single source of truth and Redux
- Concurrent mode in react
- Building performant forms in React over a hundred fields HOT 1
- About your earnings.
- The webpack adds an unnecessary file to the chunk HOT 1
- component variables access inside hooks. HOT 1
- react-fast-refresh from scratch
- Do you meditate?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ama.