Skip to content

Commit 3543fb6

Browse files
ci: apply automated fixes
1 parent f9de900 commit 3543fb6

File tree

3 files changed

+72
-46
lines changed

3 files changed

+72
-46
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ describe('router.navigate navigation using optional path parameters - function s
876876
})
877877

878878
it('should navigate from "/posts/tech" to "/posts" by setting category to undefined in function', async () => {
879-
const { router} = createOptionalParamTestRouter(
879+
const { router } = createOptionalParamTestRouter(
880880
createMemoryHistory({ initialEntries: ['/posts/tech'] }),
881881
)
882882

packages/solid-router/tests/optional-path-params.test-d.tsx

Lines changed: 65 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ test('when creating a route with optional parameters', () => {
1414
routeTree: rootRoute.addChildren([usersRoute]),
1515
})
1616

17-
expectTypeOf(usersRoute.useParams<typeof router>()).toEqualTypeOf<Accessor<{
18-
tab?: string
19-
}>>()
17+
expectTypeOf(usersRoute.useParams<typeof router>()).toEqualTypeOf<
18+
Accessor<{
19+
tab?: string
20+
}>
21+
>()
2022
})
2123

2224
test('when creating a route with mixed optional and required parameters', () => {
@@ -30,10 +32,12 @@ test('when creating a route with mixed optional and required parameters', () =>
3032
routeTree: rootRoute.addChildren([usersRoute]),
3133
})
3234

33-
expectTypeOf(usersRoute.useParams<typeof router>()).toEqualTypeOf<Accessor<{
34-
id: string
35-
tab?: string
36-
}>>()
35+
expectTypeOf(usersRoute.useParams<typeof router>()).toEqualTypeOf<
36+
Accessor<{
37+
id: string
38+
tab?: string
39+
}>
40+
>()
3741
})
3842

3943
test('when creating a route with optional param with prefix and suffix', () => {
@@ -47,9 +51,11 @@ test('when creating a route with optional param with prefix and suffix', () => {
4751
routeTree: rootRoute.addChildren([filesRoute]),
4852
})
4953

50-
expectTypeOf(filesRoute.useParams<typeof router>()).toEqualTypeOf<Accessor<{
51-
name?: string
52-
}>>()
54+
expectTypeOf(filesRoute.useParams<typeof router>()).toEqualTypeOf<
55+
Accessor<{
56+
name?: string
57+
}>
58+
>()
5359
})
5460

5561
test('when creating Link with optional parameters', () => {
@@ -63,10 +69,12 @@ test('when creating Link with optional parameters', () => {
6369
routeTree: rootRoute.addChildren([postsRoute]),
6470
})
6571

66-
expectTypeOf(postsRoute.useParams<typeof router>()).toEqualTypeOf<Accessor<{
67-
category?: string
68-
slug?: string
69-
}>>()
72+
expectTypeOf(postsRoute.useParams<typeof router>()).toEqualTypeOf<
73+
Accessor<{
74+
category?: string
75+
slug?: string
76+
}>
77+
>()
7078
})
7179

7280
test('when using optional parameters in loaders', () => {
@@ -84,9 +92,11 @@ test('when using optional parameters in loaders', () => {
8492
routeTree: rootRoute.addChildren([postsRoute]),
8593
})
8694

87-
expectTypeOf(postsRoute.useLoaderData<typeof router>()).toEqualTypeOf<Accessor<{
88-
category?: string
89-
}>>()
95+
expectTypeOf(postsRoute.useLoaderData<typeof router>()).toEqualTypeOf<
96+
Accessor<{
97+
category?: string
98+
}>
99+
>()
90100
})
91101

92102
test('when using optional parameters in beforeLoad', () => {
@@ -104,9 +114,11 @@ test('when using optional parameters in beforeLoad', () => {
104114
routeTree: rootRoute.addChildren([postsRoute]),
105115
})
106116

107-
expectTypeOf(postsRoute.useParams<typeof router>()).toEqualTypeOf<Accessor<{
108-
category?: string
109-
}>>()
117+
expectTypeOf(postsRoute.useParams<typeof router>()).toEqualTypeOf<
118+
Accessor<{
119+
category?: string
120+
}>
121+
>()
110122
})
111123

112124
test('when using params.parse with optional parameters', () => {
@@ -134,9 +146,11 @@ test('when using params.parse with optional parameters', () => {
134146
})
135147

136148
// Note: Type inference for params.parse is still complex - this represents current working behavior
137-
expectTypeOf(postsRoute.useParams<typeof router>()).toMatchTypeOf<Accessor<{
138-
page?: number | undefined
139-
}>>()
149+
expectTypeOf(postsRoute.useParams<typeof router>()).toMatchTypeOf<
150+
Accessor<{
151+
page?: number | undefined
152+
}>
153+
>()
140154
})
141155

142156
test('when nesting routes with optional parameters', () => {
@@ -154,10 +168,12 @@ test('when nesting routes with optional parameters', () => {
154168
routeTree: rootRoute.addChildren([postsRoute.addChildren([postRoute])]),
155169
})
156170

157-
expectTypeOf(postRoute.useParams<typeof router>()).toEqualTypeOf<Accessor<{
158-
category?: string
159-
postId: string
160-
}>>()
171+
expectTypeOf(postRoute.useParams<typeof router>()).toEqualTypeOf<
172+
Accessor<{
173+
category?: string
174+
postId: string
175+
}>
176+
>()
161177
})
162178

163179
test('when combining optional parameters with wildcards', () => {
@@ -171,10 +187,12 @@ test('when combining optional parameters with wildcards', () => {
171187
routeTree: rootRoute.addChildren([docsRoute]),
172188
})
173189

174-
expectTypeOf(docsRoute.useParams<typeof router>()).toEqualTypeOf<Accessor<{
175-
version?: string
176-
_splat?: string
177-
}>>()
190+
expectTypeOf(docsRoute.useParams<typeof router>()).toEqualTypeOf<
191+
Accessor<{
192+
version?: string
193+
_splat?: string
194+
}>
195+
>()
178196
})
179197

180198
test('when using ResolveOptionalParams utility type', () => {
@@ -200,13 +218,15 @@ test('complex scenario with optional parameters only', () => {
200218
routeTree: rootRoute.addChildren([complexRoute]),
201219
})
202220

203-
expectTypeOf(complexRoute.useParams<typeof router>()).toEqualTypeOf<Accessor<{
204-
env?: string
205-
version?: string
206-
id: string
207-
tab?: string
208-
_splat?: string
209-
}>>()
221+
expectTypeOf(complexRoute.useParams<typeof router>()).toEqualTypeOf<
222+
Accessor<{
223+
env?: string
224+
version?: string
225+
id: string
226+
tab?: string
227+
_splat?: string
228+
}>
229+
>()
210230
})
211231

212232
test('edge case - all optional parameters', () => {
@@ -220,9 +240,11 @@ test('edge case - all optional parameters', () => {
220240
routeTree: rootRoute.addChildren([allOptionalRoute]),
221241
})
222242

223-
expectTypeOf(allOptionalRoute.useParams<typeof router>()).toEqualTypeOf<Accessor<{
224-
category?: string
225-
subcategory?: string
226-
item?: string
227-
}>>()
243+
expectTypeOf(allOptionalRoute.useParams<typeof router>()).toEqualTypeOf<
244+
Accessor<{
245+
category?: string
246+
subcategory?: string
247+
item?: string
248+
}>
249+
>()
228250
})

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,9 @@ describe('statusCode reset on navigation', () => {
16691669

16701670
await router.navigate({ to: '/loader-throws-not-found' })
16711671
await waitFor(() => expect(router.state.statusCode).toBe(404))
1672-
expect(await screen.findByTestId('not-found-component')).toBeInTheDocument()
1672+
expect(
1673+
await screen.findByTestId('not-found-component'),
1674+
).toBeInTheDocument()
16731675
expect(screen.queryByTestId('route-component')).not.toBeInTheDocument()
16741676
})
16751677

@@ -1708,7 +1710,9 @@ describe('statusCode reset on navigation', () => {
17081710

17091711
await router.navigate({ to: '/beforeload-throws-not-found' })
17101712
await waitFor(() => expect(router.state.statusCode).toBe(404))
1711-
expect(await screen.findByTestId('not-found-component')).toBeInTheDocument()
1713+
expect(
1714+
await screen.findByTestId('not-found-component'),
1715+
).toBeInTheDocument()
17121716
expect(screen.queryByTestId('route-component')).not.toBeInTheDocument()
17131717
})
17141718

0 commit comments

Comments
 (0)