






























@@ -50,6 +50,14 @@ function makePrompter(confirmValue: boolean): DoctorPrompter {
5050};
5151}
525253+function requireAuthConfig(config: OpenClawConfig): NonNullable<OpenClawConfig["auth"]> {
54+expect(config.auth).toBeDefined();
55+if (!config.auth) {
56+throw new Error("expected repaired auth config");
57+}
58+return config.auth;
59+}
60+5361beforeEach(() => {
5462resolvePluginProvidersMock.mockReset();
5563resolvePluginProvidersMock.mockReturnValue([]);
@@ -144,13 +152,14 @@ describe("maybeRepairLegacyOAuthProfileIds", () => {
144152provider: "anthropic",
145153legacyProfileId: "anthropic:default",
146154});
147-expect(next.auth?.profiles?.["anthropic:default"]).toBeUndefined();
148-expect(next.auth?.profiles?.["anthropic:user@example.com"]).toMatchObject({
155+const auth = requireAuthConfig(next);
156+expect(auth.profiles?.["anthropic:default"]).toBeUndefined();
157+expect(auth.profiles?.["anthropic:user@example.com"]).toMatchObject({
149158provider: "anthropic",
150159mode: "oauth",
151160email: "user@example.com",
152161});
153-expect(next.auth?.order?.anthropic).toEqual(["anthropic:user@example.com"]);
162+expect(auth.order?.anthropic).toEqual(["anthropic:user@example.com"]);
154163});
155164156165it("strips provider-controlled terminal escapes from repair prompts", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。