AnotherDaphne / cosi-103a

0 stars 1 forks source link

Cleanup: Render components in unit tests, rather than reading in html files #109

Closed jdelfino closed 5 months ago

jdelfino commented 5 months ago

The tests in App.test.js currently load in a static html file that is generated by building the app. e.g. line 9, is reading in a file from disk.

Instead, the tests should load and render the components using code. I recommend using the "React Testing Library". There's a quickstart here. If you look at the first example, you'll see that the test renders the components, then makes assertions about it.

Because you're using React Router, you'll also need to refer to this explanation of how to test components that live under a Router element.