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

Function validateSearchParams

packages/solid-router/tests/router.test.tsx:40–49  ·  view source on GitHub ↗
(expected: TExpected, router: AnyRouter)

Source from the content-addressed store, hash-verified

38const mockFn1 = vi.fn()
39
40export function validateSearchParams<
41 TExpected extends Partial<Record<string, string>>,
42>(expected: TExpected, router: AnyRouter) {
43 const parsedSearch = new URLSearchParams(window.location.search)
44 expect(parsedSearch.size).toBe(Object.keys(expected).length)
45 for (const [key, value] of Object.entries(expected)) {
46 expect(parsedSearch.get(key)).toBe(value)
47 }
48 expect(router.state.location.search).toEqual(expected)
49}
50
51function createTestRouter(
52 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