




















@@ -57,6 +57,15 @@ function requireAuthConfig(config: OpenClawConfig): NonNullable<OpenClawConfig["
5757return config.auth;
5858}
595960+function requireFirstMockArg<T>(mock: { mock: { calls: T[][] } }, label: string): T {
61+const call = mock.mock.calls.at(0);
62+if (!call) {
63+throw new Error(`expected ${label} call`);
64+}
65+const [arg] = call;
66+return arg;
67+}
68+6069beforeEach(() => {
6170resolvePluginProvidersMock.mockReset();
6271resolvePluginProvidersMock.mockReturnValue([]);
@@ -140,17 +149,15 @@ describe("maybeRepairLegacyOAuthProfileIds", () => {
140149);
141150142151expect(repairMocks.repairOAuthProfileIdMismatch).toHaveBeenCalledOnce();
143-const repairCall = repairMocks.repairOAuthProfileIdMismatch.mock.calls[0]?.[0] as
144-| {
145-cfg?: OpenClawConfig;
146-store?: AuthProfileStore;
147-provider?: unknown;
148-legacyProfileId?: unknown;
149-}
150-| undefined;
151-if (!repairCall) {
152-throw new Error("expected OAuth profile repair call");
153-}
152+const repairCall = requireFirstMockArg(
153+repairMocks.repairOAuthProfileIdMismatch,
154+"OAuth profile repair",
155+) as {
156+cfg?: OpenClawConfig;
157+store?: AuthProfileStore;
158+provider?: unknown;
159+legacyProfileId?: unknown;
160+};
154161expect(repairCall.cfg?.auth?.profiles?.["anthropic:default"]).toEqual({
155162provider: "anthropic",
156163mode: "oauth",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。