Skip to content

Lab 12: Testing

  • Make all test pass
  • 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
  • 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