You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
804 B
28 lines
804 B
import { describe, expect, it } from "vitest";
|
|
import {
|
|
formatExternalSiteNavigationError,
|
|
isTransientNavigationError,
|
|
} from "@/lib/rpa/page-goto";
|
|
|
|
describe("page-goto resilience", () => {
|
|
it("detects connection reset as transient", () => {
|
|
expect(
|
|
isTransientNavigationError(
|
|
new Error(
|
|
"page.goto: net::ERR_CONNECTION_RESET at https://www.priority1.com/",
|
|
),
|
|
),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("formats user-facing Priority1 navigation error", () => {
|
|
const msg = formatExternalSiteNavigationError(
|
|
"Priority1 官网",
|
|
new Error("page.goto: net::ERR_CONNECTION_RESET"),
|
|
);
|
|
expect(msg).toContain("连接被重置");
|
|
expect(msg).toContain("网络与代理");
|
|
expect(msg).not.toMatch(/ERR_|page\.goto|RPA_PROXY/i);
|
|
});
|
|
});
|