simonhamp / the-og

A pure PHP OpenGraph Image Generator
MIT License
244 stars 12 forks source link

Use snapshots to automate testing #3

Closed svenluijten closed 9 months ago

svenluijten commented 9 months ago

Instead of (only) relying on manual testing, we could implement something like Spatie's snapshot assertions to assert none of the previous features break when implementing something new.

How do you feel about this? I'll be more than happy to implement it, just wanna gauge interest before I commit time to it 😄

simonhamp commented 9 months ago

Yeh I really like this idea 🙌🏼

Will be a great way to reliably test different variations of layouts and themes and settings

My only concern is that doing it this early on, things could change a lot, so maybe it will not be that useful to implement just yet?

svenluijten commented 9 months ago

My only concern is that doing it this early on, things could change a lot, so maybe it will not be that useful to implement just yet?

It's fairly trivial to update the snapshots, and as long as that is done consciously it's fine. I see snapshot testing more as regression testing (preventing bugs to sneak into previous features when implementing something else), and you (probably) wouldn't use it in a TDD-way. I'll see if I can get a PR in either today or tomorrow!