Unit tests

These are used to test an isolated component. If the component is not isolated—that is, if the component has some dependencies—we will have to use some tools and practices, such as stubs or dependency injections, to try to isolate it as much as we can during the test. If it is not possible to manipulate the component's dependencies, we will use spies to facilitate the creation of the unit tests. Our main goal should be to achieve the total isolation of a component when it is tested. A unit test should also be fast, and we should try to avoid input/output, network usage, and any other operations that could potentially affect the speed of the test.

Get Learning TypeScript 2.x - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.