Skip to content

App.test "renders learn react link" fails #166

@complex-confusion

Description

@complex-confusion

Describe the bug
Using the main branch, App.test.js fails with the following message.

Also, the test name, "renders learn react link," no longer matches what the test actually asserts (that the screen contains the string "Shell".)

 FAIL  src/App.test.js
  ✕ renders learn react link (63 ms)

  ● renders learn react link

    TypeError: Cannot read properties of undefined (reading 'matches')

      13 |     return savedTheme;
      14 |   }
    > 15 |   return window.matchMedia("(prefers-color-scheme: dark)").matches
         |                                                           ^
      16 |     ? dark
      17 |     : light;
      18 | };

To Reproduce

Run npm run test and type a when prompted.

Possible Solution
Choose what you actually want to test. If only testing that the App page is displaying, assert the presence of text that isn't buried within a dropdown. If testing the contents of the dropdown, the test may need to click on the language dropdown for the string "Shell" to be displayed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions