seanmturley / natureddit

A simple Reddit client, featuring a landing page dedicated to nature with posts pulled from a curated list of subreddits.
0 stars 1 forks source link

Add testing for ErrorPage & LoadingOverlay #75

Open seanmturley opened 1 year ago

seanmturley commented 1 year ago

Description

As far as I can see, testing the ErrorPage component requires testing and rendering the full App with specific URLs that will generate different types of errors. Unfortunately, App renders a router (the router, in fact), so when it is rendered with setupWithRouting or the now removed setupWithUrl testing utility functions the following error occurs:

"You cannot render a inside another . You should never have more than one in your app."

The same issue is true for testing the LoadingOverlay, which is rendered by the MainLayout.

Questions

seanmturley commented 1 year ago

Added notes to the OP to describe the options of testing at the layout level (and rendering Outlets), plus the need to mock API requests.

This is quite involved, and more research is required to determine the best way forward.

seanmturley commented 1 year ago

I've abandoned local changes for now as nothing much was achieved in implementing the tests, and I want to move onto new features. This task will be set aside to revisit later.