Files
geo/apps/desktop-client/src/main/platform-auth-adapters.test.ts
T

25 lines
732 B
TypeScript
Raw Normal View History

import { beforeAll, describe, expect, it, vi } from "vitest";
vi.mock("./account-binder", () => ({
probePublishAccountSession: vi.fn(),
silentRefreshPublishAccountSession: vi.fn(),
}));
let getPlatformAdapter: typeof import("./platform-auth-adapters").getPlatformAdapter;
beforeAll(async () => {
({ getPlatformAdapter } = await import("./platform-auth-adapters"));
});
describe("platform auth adapters", () => {
it("classifies Wenxin environment abnormal messages as risk control", () => {
const adapter = getPlatformAdapter("wenxin");
expect(
adapter.classifyFailure({
message: "当前访问环境存在异常,请更换浏览器再尝试提问",
}),
).toBe("risk_control");
});
});