|
|
|
|
|
by qudat
2017 days ago
|
|
What would you test with just a pure react component? What are you actually testing? Given some props it prints certain html? I’d argue that test is not that useful. Instead what we do in the react world today is focus on integration tests. Testing what happens when you navigate to a page, click on elements, and make sure it does what it is supposed to. |
|
Just as you probably don’t get much value out of testing a function that increments an input number, but you may get a lot of value out of testing, say, a function that generates a series of smooth quadratic curves over a series of points.
And that’s a much easier thing to test at the unit level than integration.
It seems to me that either:
- your usage of props and rendering isn’t particularly complex, but your interaction model is
- you’re using state to manage that complexity where someone else may model it without state
I’m not passing judgment if it’s the latter, it’s fairly common in the frontend world to model that way. But it’s certainly not my preference.