fix: 修复 list-params 空字符串关键字处理和 useConfirmAction 测试类型错误

This commit is contained in:
2026-06-05 17:31:53 +08:00
parent 3b77041100
commit 72a71818e7
2 changed files with 3 additions and 11 deletions

View File

@@ -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;

View File

@@ -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("失败");