Skip to content

Migrate BrowserRouter to MemoryRouter in 2 remaining test files #1646

@arbrandes

Description

@arbrandes

Context

PR #1641 review noted that the PR correctly migrated most test files from BrowserRouter to MemoryRouter, which is React Router's recommended approach for unit tests (keeps location changes in memory without touching the browser's history API). Two test files were not part of the PR's scope and still use BrowserRouter.

Files

1. src/common-components/tests/EmbeddedRegistrationRoute.test.jsx

  • 2 BrowserRouter usages (1 import, 1 render wrapper)
  • Replace with MemoryRouter and pass initialEntries as needed

2. src/common-components/tests/UnAuthOnlyRoute.test.jsx

  • 2 BrowserRouter usages (1 import, 1 render wrapper)
  • Replace with MemoryRouter and pass initialEntries as needed

Migration pattern

Each file will:

  1. Replace import { BrowserRouter } with import { MemoryRouter } from react-router-dom
  2. Replace <BrowserRouter> wrapper with <MemoryRouter initialEntries={['/path']}> using the appropriate test route

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions