Skip to content

Commit 219b72c

Browse files
authored
test(router): set notFoundComponent in statusCode test (#5742)
test(router): set notfound component in statusCode test
1 parent 470f9b6 commit 219b72c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/react-router/tests/router.test.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,11 @@ describe('statusCode', () => {
20242024
it('should set statusCode to 404 when a route beforeLoad throws a notFound()', async () => {
20252025
const history = createMemoryHistory({ initialEntries: ['/'] })
20262026

2027-
const rootRoute = createRootRoute()
2027+
const rootRoute = createRootRoute({
2028+
notFoundComponent: () => (
2029+
<div data-testid="not-found-component">Not Found</div>
2030+
),
2031+
})
20282032

20292033
const indexRoute = createRoute({
20302034
getParentRoute: () => rootRoute,

packages/solid-router/tests/router.test.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1678,7 +1678,11 @@ describe('statusCode reset on navigation', () => {
16781678
it('should set statusCode to 404 when a route beforeLoad throws a notFound()', async () => {
16791679
const history = createMemoryHistory({ initialEntries: ['/'] })
16801680

1681-
const rootRoute = createRootRoute()
1681+
const rootRoute = createRootRoute({
1682+
notFoundComponent: () => (
1683+
<div data-testid="not-found-component">Not Found</div>
1684+
),
1685+
})
16821686

16831687
const indexRoute = createRoute({
16841688
getParentRoute: () => rootRoute,

0 commit comments

Comments
 (0)