MCPcopy
hub / github.com/TanStack/router / validateSearchParams

Function validateSearchParams

packages/react-router/tests/router.test.tsx:67–76  ·  view source on GitHub ↗
(expected: TExpected, router: AnyRouter)

Source from the content-addressed store, hash-verified

65] as const
66
67export function validateSearchParams<
68 TExpected extends Partial<Record<string, string>>,
69>(expected: TExpected, router: AnyRouter) {
70 const parsedSearch = new URLSearchParams(window.location.search)
71 expect(parsedSearch.size).toBe(Object.keys(expected).length)
72 for (const [key, value] of Object.entries(expected)) {
73 expect(parsedSearch.get(key)).toBe(value)
74 }
75 expect(router.state.location.search).toEqual(expected)
76}
77
78function createTestRouter(
79 options: RouterOptions<AnyRoute, 'never', any, any, any> &

Callers 2

router.test.tsxFile · 0.70
checkSearchFunction · 0.70

Calls 1

getMethod · 0.65

Tested by

no test coverage detected