Przeglądaj źródła

refactor(test): drop embedded expect from applyLastSearchFn

Return undefined when last navigate options are missing so assertion
failures point at the calling test
satnaing 2 miesięcy temu
rodzic
commit
178c292f98
1 zmienionych plików z 2 dodań i 2 usunięć
  1. 2 2
      src/hooks/use-table-url-state.test.ts

+ 2 - 2
src/hooks/use-table-url-state.test.ts

@@ -12,8 +12,8 @@ function applyLastSearchFn(
   prev: Record<string, unknown>
 ) {
   const opts = lastNavigateOpts(navigate)
-  expect(opts).toBeDefined()
-  const s = opts!.search
+  if (!opts) return undefined
+  const s = opts.search
   if (typeof s === 'function') {
     return s(prev) as Record<string, unknown>
   }