dcramer / peated

https://peated.com
Apache License 2.0
64 stars 13 forks source link

Improve mock factories #220

Open dcramer opened 3 months ago

dcramer commented 3 months ago

There's a conflict of interests right now with fixtures:

1) We want them to be semi accurate to generate mocks for the UI

2) We want them to always be idempotent to work in tests

While yes, you could technically achieve 1/2, its quite difficult if we want realistic mock data.

I think the solution here is to break it up, rename them to factories (thats what they are), and have fixtures inhereit from that with predetermined values. Whenever a test needs multiple variants of a fixture, it will be required to override it. That ensures we've got stable-ish fixtures.