mirror of https://github.com/openclaw/openclaw.git
fix: annotate shared failover mocks (openclaw#39820) thanks @lupuletic
This commit is contained in:
parent
dd6ecd5bfa
commit
61bf7b8536
|
|
@ -209,7 +209,6 @@ vi.mock("../defaults.js", () => ({
|
||||||
DEFAULT_PROVIDER: "anthropic",
|
DEFAULT_PROVIDER: "anthropic",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const mockedCoerceToFailoverError = vi.fn();
|
|
||||||
type MockFailoverErrorDescription = {
|
type MockFailoverErrorDescription = {
|
||||||
message: string;
|
message: string;
|
||||||
reason: string | undefined;
|
reason: string | undefined;
|
||||||
|
|
@ -217,7 +216,15 @@ type MockFailoverErrorDescription = {
|
||||||
code: string | undefined;
|
code: string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const mockedDescribeFailoverError = vi.fn(
|
type MockCoerceToFailoverError = (
|
||||||
|
err: unknown,
|
||||||
|
params?: { provider?: string; model?: string; profileId?: string },
|
||||||
|
) => unknown;
|
||||||
|
type MockDescribeFailoverError = (err: unknown) => MockFailoverErrorDescription;
|
||||||
|
type MockResolveFailoverStatus = (reason: string) => number | undefined;
|
||||||
|
|
||||||
|
export const mockedCoerceToFailoverError = vi.fn<MockCoerceToFailoverError>();
|
||||||
|
export const mockedDescribeFailoverError = vi.fn<MockDescribeFailoverError>(
|
||||||
(err: unknown): MockFailoverErrorDescription => ({
|
(err: unknown): MockFailoverErrorDescription => ({
|
||||||
message: err instanceof Error ? err.message : String(err),
|
message: err instanceof Error ? err.message : String(err),
|
||||||
reason: undefined,
|
reason: undefined,
|
||||||
|
|
@ -225,7 +232,7 @@ export const mockedDescribeFailoverError = vi.fn(
|
||||||
code: undefined,
|
code: undefined,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
export const mockedResolveFailoverStatus = vi.fn();
|
export const mockedResolveFailoverStatus = vi.fn<MockResolveFailoverStatus>();
|
||||||
|
|
||||||
vi.mock("../failover-error.js", () => ({
|
vi.mock("../failover-error.js", () => ({
|
||||||
FailoverError: class extends Error {},
|
FailoverError: class extends Error {},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue