Writing our first test

Now that we are all set with the testing setup, we can start writing our first test. In this section, we will create a first test for the efforts component that we created in Chapter 8, Time Will Tell.

As Angular components are just classes, we can already test a lot of their functionality by instantiating the component class and testing its methods. Tests that can be performed like this should always be considered first. Tests that don't involve the rendering logic of your components can run without Angular compiling and bootstrap the component.

The efforts component uses a method to add a certain amount of hours to the effective time worked on a task. Within the template of the efforts component, we're providing three ...

Get Mastering Angular Components 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.