fix: 修复 list-params 空字符串关键字处理和 useConfirmAction 测试类型错误
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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("失败");
|
||||
|
||||
Reference in New Issue
Block a user