From the course: Angular: Workflows

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Jest and Snapshot testing

Jest and Snapshot testing - Angular Tutorial

From the course: Angular: Workflows

Start my 1-month free trial

Jest and Snapshot testing

- [Instructor] Now that Jest is set up, let's right our tests. Let's first create a test host component that we can use to test the actual component. Declare our component here. The template will include the component that's in test. Vm-hacker-status. It takes in an input of status, and this will be a property on this test host component, and we can close this element there. Call the Z test host component, and has one property, app status, which is of type string. Let's fix this import here and import component from angular core. We can re-declare the test host in the fixture now. The test host will be of type test host component, and we will create a component fixture of type test host component. In the declarations, we want to add this new test host along with the component in test. We compile our components, the fixture, we want to create a test host component and we rename this test host, since that's the component in test. And looks like I need to update this to test host…

Contents