mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 12:47:39 +00:00
test: dedupe non-matching unhandled rejection cases
This commit is contained in:
@@ -35,19 +35,12 @@ describe("isAbortError", () => {
|
|||||||
expect(isAbortError(new Error("Request was aborted"))).toBe(false);
|
expect(isAbortError(new Error("Request was aborted"))).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns false for null and undefined", () => {
|
it.each([null, undefined, "string error", 42, { message: "plain object" }])(
|
||||||
expect(isAbortError(null)).toBe(false);
|
"returns false for non-abort input %#",
|
||||||
expect(isAbortError(undefined)).toBe(false);
|
(value) => {
|
||||||
});
|
expect(isAbortError(value)).toBe(false);
|
||||||
|
},
|
||||||
it("returns false for non-error values", () => {
|
);
|
||||||
expect(isAbortError("string error")).toBe(false);
|
|
||||||
expect(isAbortError(42)).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("returns false for plain objects without AbortError name", () => {
|
|
||||||
expect(isAbortError({ message: "plain object" })).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("isTransientNetworkError", () => {
|
describe("isTransientNetworkError", () => {
|
||||||
@@ -110,16 +103,12 @@ describe("isTransientNetworkError", () => {
|
|||||||
expect(isTransientNetworkError(error)).toBe(false);
|
expect(isTransientNetworkError(error)).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns false for null and undefined", () => {
|
it.each([null, undefined, "string error", 42, { message: "plain object" }])(
|
||||||
expect(isTransientNetworkError(null)).toBe(false);
|
"returns false for non-network input %#",
|
||||||
expect(isTransientNetworkError(undefined)).toBe(false);
|
(value) => {
|
||||||
});
|
expect(isTransientNetworkError(value)).toBe(false);
|
||||||
|
},
|
||||||
it("returns false for non-error values", () => {
|
);
|
||||||
expect(isTransientNetworkError("string error")).toBe(false);
|
|
||||||
expect(isTransientNetworkError(42)).toBe(false);
|
|
||||||
expect(isTransientNetworkError({ message: "plain object" })).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("returns false for AggregateError with only non-network errors", () => {
|
it("returns false for AggregateError with only non-network errors", () => {
|
||||||
const error = new AggregateError([new Error("regular error")], "Multiple errors");
|
const error = new AggregateError([new Error("regular error")], "Multiple errors");
|
||||||
|
|||||||
Reference in New Issue
Block a user