Command Shift

Search - update tests πŸ”¬

Overview

Our app is working, there are no errors in the browser console, but we need to check and update tests:

  1. The test suite for <App /> should fail, specifically the snapshot test ("renders correctly"). Look for red text: ● App β€Ί renders correctly.
  2. Our new component <SearchForm /> has no tests. What tests would you write here?

1. Fix existing tests

This one is easy, you've done it a couple of times already. πŸ˜‰

2. Write new tests for <SearchForm />

As with any testing, let's first think of what we can test, remembering some techniques/type of tests available in RTL:

  • we can do snapshot testing again,
  • we can check if <button> displays the correct text.

Can you write these tests yourself without a walkthrough?

On this page