-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(test) Add renderWithRouter wrapper (#1373)
This adds a wrapper for rendering components with react-router-dom for testing purposes. This is needed because components that use routing features require a Router context to work properly. Its parameters are: - component: The component to render. - initialRoute: The initial route to set for the router. Defaults to `/`, the root path. It uses `MemoryRouter` instead of `BrowserRouter` because `MemoryRouter` stores its history in memory, which is suitable for testing purposes. - initialEntries: The initial entries to set for the router. Defaults to `['/']`, the root path. - it sets up a basic Routes configuration with a single Route that matches the root path and renders the component passed to the wrapper.
- Loading branch information
1 parent
e009969
commit 7fc67b1
Showing
3 changed files
with
67 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters