git checkout ut-09-component-integration-testing
yarn
yarn test farmicode --watch
-
Check that animal names are displayed instead of checking the
<fz-animal-list>
component'sanimals
input. -
You can get an element's text using the
DebugElement
'snativeElement.textContent
property.
You can create a test helper in animal-list.test-helper.ts
as an abstraction for DOM testing.
export function getAnimalListTestHelper(element: DebugElement) {
return {
getAnimalNames(): string[] {
...
}
}
}