Lab 12: Testing
Objectives
- Make all test pass
Tasks
Task 1: Fix all dependecies:
- For all components, you need in the test to import all elements that usually are imported in the
app.module.ts. - Some exceptions:
- Components or dependences using
RouterModule, importRouterTestingModuleinstead - Components or dependences using
HttpModule, importeHttpTestingModuleinstead
- Components or dependences using
Task 2: Simple test.
- In
album.component.spec.ts. we want to test thatartist.titleandalbum.titleare rendering correctly in our html. - Create a new test case and get the
h3element and check that the content match some of thealbumproperties
compiled.querySelector('h3').textContent
- Use
expectwith this selector