Command Shift

Testing Forecast Summaries (lists) πŸ”¬

Challenge

In the previous tests we have written, we have been testing components that only render basic elements. However, the <ForecastSummaries /> component we have written doesn't do this - it renders the <ForecastSummary /> component multiple times.

Before you start writing tests, try to answer these questions:

  • What could be the most important thing to test here? Please remember that tests for particular values already have been tested.
  • What should be tested first?
  • What type of queries and assertions might you want use this time?

πŸ’‘ Remember to check the RTL docs if you're not sure what to use or how to use it.

Instructions:

Snapshot testing

  1. Create test file, add describe block with validProps.
  2. Add snapshot testing.
  3. Run the test for this file.

List testing

  1. Prepare <ForecastSummary />.
  2. Fix failing tests.
  3. Test for list length.
  4. Check tests again.

On this page