Skip to content

Commit 13d45c1

Browse files
committed
maybe like this?
1 parent 051390a commit 13d45c1

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,16 @@ test('should show pendingComponent of root route', async () => {
128128
loader: async () => {
129129
await new Promise((r) => setTimeout(r, 50))
130130
},
131-
})
132-
const index = createRoute({
133-
getParentRoute: () => root,
134-
path: '/',
135-
component: () => <div>index route</div>,
131+
component: () => 'root content',
136132
})
137133
const router = createRouter({
138-
routeTree: root.addChildren([index]),
134+
routeTree: root,
139135
defaultPendingMs: 0,
140136
defaultPendingComponent: () => <div>default pending...</div>,
141137
})
142138

143139
const rendered = render(<RouterProvider router={router} />)
144140

145141
expect(await rendered.findByText('root pending...')).toBeInTheDocument()
146-
expect(await rendered.findByText('index route')).toBeInTheDocument()
142+
expect(await rendered.findByText('root content')).toBeInTheDocument()
147143
})

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,20 +228,17 @@ test('should show pendingComponent of root route', async () => {
228228
loader: async () => {
229229
await new Promise((r) => setTimeout(r, 50))
230230
},
231+
component: () => 'root content',
231232
})
232-
const index = createRoute({
233-
getParentRoute: () => root,
234-
path: '/',
235-
component: () => <div>index route</div>,
236-
})
233+
237234
const router = createRouter({
238-
routeTree: root.addChildren([index]),
235+
routeTree: root,
239236
defaultPendingMs: 0,
240237
defaultPendingComponent: () => <div>default pending...</div>,
241238
})
242239

243240
const rendered = render(() => <RouterProvider router={router} />)
244241

245242
expect(await rendered.findByText('root pending...')).toBeInTheDocument()
246-
expect(await rendered.findByText('index route')).toBeInTheDocument()
243+
expect(await rendered.findByText('root content')).toBeInTheDocument()
247244
})

0 commit comments

Comments
 (0)