mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 18:48:27 +00:00
fix: promote selected auth profile order
This commit is contained in:
@@ -5,7 +5,10 @@ import path from "node:path";
|
||||
import type { OAuthCredentials } from "@mariozechner/pi-ai";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
|
||||
import { writeOAuthCredentials } from "./onboard-auth.js";
|
||||
import {
|
||||
applyAuthProfileConfig,
|
||||
writeOAuthCredentials,
|
||||
} from "./onboard-auth.js";
|
||||
|
||||
describe("writeOAuthCredentials", () => {
|
||||
const previousStateDir = process.env.CLAWDBOT_STATE_DIR;
|
||||
@@ -77,3 +80,28 @@ describe("writeOAuthCredentials", () => {
|
||||
).rejects.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe("applyAuthProfileConfig", () => {
|
||||
it("promotes the newly selected profile to the front of auth.order", () => {
|
||||
const next = applyAuthProfileConfig(
|
||||
{
|
||||
auth: {
|
||||
profiles: {
|
||||
"anthropic:default": { provider: "anthropic", mode: "api_key" },
|
||||
},
|
||||
order: { anthropic: ["anthropic:default"] },
|
||||
},
|
||||
},
|
||||
{
|
||||
profileId: "anthropic:claude-cli",
|
||||
provider: "anthropic",
|
||||
mode: "oauth",
|
||||
},
|
||||
);
|
||||
|
||||
expect(next.auth?.order?.anthropic).toEqual([
|
||||
"anthropic:claude-cli",
|
||||
"anthropic:default",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user