mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-16 01:40:43 +00:00
test: tighten auth repair assertions
This commit is contained in:
@@ -50,6 +50,14 @@ function makePrompter(confirmValue: boolean): DoctorPrompter {
|
||||
};
|
||||
}
|
||||
|
||||
function requireAuthConfig(config: OpenClawConfig): NonNullable<OpenClawConfig["auth"]> {
|
||||
expect(config.auth).toBeDefined();
|
||||
if (!config.auth) {
|
||||
throw new Error("expected repaired auth config");
|
||||
}
|
||||
return config.auth;
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
resolvePluginProvidersMock.mockReset();
|
||||
resolvePluginProvidersMock.mockReturnValue([]);
|
||||
@@ -144,13 +152,14 @@ describe("maybeRepairLegacyOAuthProfileIds", () => {
|
||||
provider: "anthropic",
|
||||
legacyProfileId: "anthropic:default",
|
||||
});
|
||||
expect(next.auth?.profiles?.["anthropic:default"]).toBeUndefined();
|
||||
expect(next.auth?.profiles?.["anthropic:user@example.com"]).toMatchObject({
|
||||
const auth = requireAuthConfig(next);
|
||||
expect(auth.profiles?.["anthropic:default"]).toBeUndefined();
|
||||
expect(auth.profiles?.["anthropic:user@example.com"]).toMatchObject({
|
||||
provider: "anthropic",
|
||||
mode: "oauth",
|
||||
email: "user@example.com",
|
||||
});
|
||||
expect(next.auth?.order?.anthropic).toEqual(["anthropic:user@example.com"]);
|
||||
expect(auth.order?.anthropic).toEqual(["anthropic:user@example.com"]);
|
||||
});
|
||||
|
||||
it("strips provider-controlled terminal escapes from repair prompts", async () => {
|
||||
|
||||
Reference in New Issue
Block a user