DEV Community

Discussion on: Creating a React component with TDD

Collapse
 
idanen profile image
Idan Entin

In such case the functionality test would fail thanks to getByRole

Thread Thread
 
harmlessevil profile image
Alexander

In general you’re right, but if you won’t remove the first test, then both will fail. For some people it will be enough to understand a reason just by looking to the names of failed tests.

In your case developer will have to look in the message of failed test.

That’s how I understand the idea of writing tests with such granularity

Thread Thread
 
idanen profile image
Idan Entin

How many tests do you expect to fail if you make the button not available?
I think 2 failing tests are more confusing than one, even if I have to read the message (the title still helps me understand what failed - clicking the button)