Skip to main content

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, import RouterTestingModule instead
    • Components or dependences using HttpModule, importe HttpTestingModule instead

Task 2: Simple test.

  • In album.component.spec.ts. we want to test that artist.title and album.title are rendering correctly in our html.
  • Create a new test case and get the h3 element and check that the content match some of the album properties
     compiled.querySelector('h3').textContent
  • Use expect with this selector