mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 23:38:27 +00:00
refactor(onboard): unify auth-choice catalog for CLI help
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { AuthProfileStore } from "../agents/auth-profiles.js";
|
||||
import { buildAuthChoiceOptions } from "./auth-choice-options.js";
|
||||
import { buildAuthChoiceOptions, formatAuthChoiceChoicesForCli } from "./auth-choice-options.js";
|
||||
|
||||
describe("buildAuthChoiceOptions", () => {
|
||||
it("includes GitHub Copilot", () => {
|
||||
@@ -144,4 +144,32 @@ describe("buildAuthChoiceOptions", () => {
|
||||
|
||||
expect(options.some((opt) => opt.value === "vllm")).toBe(true);
|
||||
});
|
||||
|
||||
it("builds cli help choices from the same catalog", () => {
|
||||
const store: AuthProfileStore = { version: 1, profiles: {} };
|
||||
const options = buildAuthChoiceOptions({
|
||||
store,
|
||||
includeSkip: true,
|
||||
});
|
||||
const cliChoices = formatAuthChoiceChoicesForCli({
|
||||
includeLegacyAliases: false,
|
||||
includeSkip: true,
|
||||
}).split("|");
|
||||
|
||||
for (const option of options) {
|
||||
expect(cliChoices).toContain(option.value);
|
||||
}
|
||||
});
|
||||
|
||||
it("can include legacy aliases in cli help choices", () => {
|
||||
const cliChoices = formatAuthChoiceChoicesForCli({
|
||||
includeLegacyAliases: true,
|
||||
includeSkip: true,
|
||||
}).split("|");
|
||||
|
||||
expect(cliChoices).toContain("setup-token");
|
||||
expect(cliChoices).toContain("oauth");
|
||||
expect(cliChoices).toContain("claude-cli");
|
||||
expect(cliChoices).toContain("codex-cli");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user