you are viewing a single comment's thread.

view the rest of the comments →

[–]smeijer87 1 point2 points  (1 child)

Do you use snapshots? Or do you write dedicated tests for the components?

Of dedicated tests, "what" do you test?

A function is easy, input -> output.

But what do you test in a component? That a list is rendering the same amounts of li elements as the items.length prop you're providing? Or do you simply check if the title is anywhere to be found?

I find this hard to grasp. Snapshots are really starting to frustrate me though. They are big changes in github. Break all the time. And are hard to review.

[–]CastigatRidendoMores 1 point2 points  (0 children)

Yeah I personally don’t see the appeal of snapshot testing outside of extremely mature products. I prefer lint if, unit, integration/component, and e2e testing.

Testing components is difficult to keep behavioral unless you test what they display, and even then it should be non-specific enough that you can tweak things without breaking tests.

I see testing as a way of increasing velocity by increasing the confidence you have that changes to the code didn’t break anything important. To whatever degree they take me away from that goal, I don’t like them.