DEV Community

Discussion on: VueJS (2.x) - Component Testing Helper - Part I

Collapse
 
slidenerd profile image
slidenerd

stupid question, why are you asserting stuff like to have class and to have text, you can simply say toMatchSnapshot using jest, just make a snapshots directory in your test folder and put the html content of your page's expected output there

Collapse
 
vcpablo profile image
Pablo Veiga • Edited

Hey @slidenerd , this code is just an example. The main purpose of the article is to demonstrate how to create the test helper. The implemented tests are too easy to mean something :D

By the way, as you've mentioned "snapshot testing", it really depends on the type of the project.
If the software requires a "perfect" interface it is quite useful to avoid breaking even small things, but, if not, I recommend not to use it because the most insignificant change in anything (a pixel, for example) will break the tests. This might cost too much in terms of development.

Nice article about it, by the way
sitepen.com/blog/snapshot-testing-...

Thanks for participating