This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
My co-worker is an experienced frontend web developer. But I have doubts when it comes to his experience in testing.
He uses snapshots for asserting the outputs of helper functions (such as a validation function that returns an object of validated field and their errors).
I personally think it's not a good practice because it's hard to read tests when all you see in the assertion is stuff like expect(myTestFunction(input)).toMatchSnapshot();
. But his argument for this is that it gets the job done, and it's fast to write.
I'd argue that it'll be difficult to tell if a test is failing correctly, but I can't really prove my point.
Maybe I'm overthinking it. I've decided to give it a low logaf and not argue with him too much, but I'd like to ask the opinion of the people here, am I right to worry about the incorrect use of snapshots for unit tests?
Post Details
- Posted
- 1 year ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/webdev/comm...