interface RoutesTestStubProps {
    future?: Partial<FutureConfig>;
    hydrationData?: Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>;
    initialEntries?: InitialEntry[];
    initialIndex?: number;
}

Properties

future?: Partial<FutureConfig>

Future flags mimicking the settings in react-router.config.ts

hydrationData?: Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>

Used to set the route's initial loader and action data. e.g. hydrationData={{ loaderData: { "/contact": { locale: "en-US" } }, actionData: { "/login": { errors: { email: "invalid email" } }} }}

initialEntries?: InitialEntry[]

The initial entries in the history stack. This allows you to start a test with multiple locations already in the history stack (for testing a back navigation, etc.) The test will default to the last entry in initialEntries if no initialIndex is provided. e.g. initialEntries={["/home", "/about", "/contact"]}

initialIndex?: number

The initial index in the history stack to render. This allows you to start a test at a specific entry. It defaults to the last entry in initialEntries. e.g. initialEntries: ["/", "/events/123"] initialIndex: 1 // start at "/events/123"