diff --git a/src/server/helpers/list-params.ts b/src/server/helpers/list-params.ts index 414466f..119f3a0 100644 --- a/src/server/helpers/list-params.ts +++ b/src/server/helpers/list-params.ts @@ -38,7 +38,8 @@ export function parseListParams( } } - const keyword = url.searchParams.get("keyword") ?? undefined; + const keywordRaw = url.searchParams.get("keyword"); + const keyword = keywordRaw === "" ? undefined : (keywordRaw ?? undefined); const sortBy = url.searchParams.get("sortBy") ?? undefined; const sortOrderParam = url.searchParams.get("sortOrder") ?? undefined; diff --git a/tests/web/use-confirm-action.test.ts b/tests/web/use-confirm-action.test.ts index 033c381..6fea189 100644 --- a/tests/web/use-confirm-action.test.ts +++ b/tests/web/use-confirm-action.test.ts @@ -16,6 +16,7 @@ describe("useConfirmAction", () => { let resolved = false; const action = () => { resolved = true; + return Promise.resolve(); }; const { result } = renderHook(() => useConfirmAction(), { wrapper: createWrapper() }); @@ -24,16 +25,6 @@ describe("useConfirmAction", () => { expect(resolved).toBe(true); }); - it("handles action error without throwing", async () => { - const action = () => { - throw new Error("失败"); - }; - const { result } = renderHook(() => useConfirmAction(), { wrapper: createWrapper() }); - - await act(() => result.current.confirmAction(action, "成功")); - expect(resolved).toBe(true); - }); - it("handles action error without throwing", async () => { const action = () => { throw new Error("失败");