Problem: Mock datasets tend to be bloated, unreliable, and repetitive


Problem:
Mock datasets tend to be bloated, unreliable, and repetitive. So, it's often unclear what mock data can safely be changed, reused, or added.

Solution:
1. Create *strategic*, static mock data, from scratch (it often doesn't require very much data to test an app).
2. Document what each piece of mock data is for. I use the TypeScript type below to enforce it.

Benefits:
✅ The mock data is static, so automated tests are reliable and fast.
✅ Avoids needless bloat. A small, focused, purpose built dataset is easier to maintain.
✅ Documents the unique purpose of each piece of mock data.
✅ Automated tests and devtools can access specific pieces of mock data based on description, which improves test readability and documents intent.
✅ People are less likely to change critical data and break tests, because they understand the purpose of each piece of data.

Oops, there was a typo in my code example. I didn't name the const.

Fixed:

View original on X