Component testing
Angular component unit tests not only examine logic but also assess the values that will be presented on the screen.
If your application follows the component architecture recommended by the Angular team (more details in Chapter 4, Components and Pages), you probably won’t have much business logic in your components, delegating it to services.
To exemplify, in this section, we will create tests for some methods of the DiaryComponent
component.
We will create the test case for the gym diary entry deletion operation and check whether the service’s delete
method is called:
describe('DiaryComponent', () => { . . . let exerciseSetsService: ExerciseSetsService; beforeEach(async () => { await TestBed.configureTestingModule({ . . . }).compileComponents(); . . . exerciseSetsService = TestBed.inject(ExerciseSetsService...