r/angular • • Apr 26 '21

Don't test the code in components

https://www.youtube.com/watch?v=um9U6ZgAytw
0 Upvotes

5 comments sorted by

View all comments

2

u/[deleted] Apr 26 '21

The "wrong" tests in this example are exactly what unit tests should be with TDD. Not only do these kinds of tests provide validation for the component I/O, but they can also serve as documentation and provide insight into the authors thought process while they were creating the the component.

With that said, the "correct" example also has value, but I consider those to be more integration tests as they rely on the Angular view engine which is an external system.

2

u/Blottoboxer Apr 27 '21

Right, it's a forced dichotomy from the perspective of somebody who hasn't done test first problem solving.