Problem: A component is hard to test because it displays many different...


Problem:
A component is hard to test because it displays many different messages in different scenarios.

Solution:
1. Put the test data in a well-named structure.
2. Loop over it.

I call this the “mad libs” testing pattern. 😄

This enforces consistency and clarifies intent.

View original on X