mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-04 01:34:06 +00:00
Refactor OpenAI provider identity so OpenAI remains the canonical provider for API-key and OAuth-backed flows while legacy openai-codex state is doctor/migration-only. Keeps OpenAI Codex Responses as an API/transport class rather than a provider identity, moves auth aliases through providerAuthAliases, updates doctor repair sequencing for old auth/profile state, and refreshes tests/docs around the canonical OpenAI behavior.
24 lines
1.0 KiB
TypeScript
24 lines
1.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { buildOpenAISetupProvider } from "./setup-api.js";
|
|
|
|
function authMethodIds(provider: ReturnType<typeof buildOpenAISetupProvider>) {
|
|
return provider.auth.map((method) => method.id);
|
|
}
|
|
|
|
describe("OpenAI setup auth provider", () => {
|
|
it("offers ChatGPT login as the default OpenAI auth path while keeping API key explicit", () => {
|
|
const provider = buildOpenAISetupProvider();
|
|
const oauth = provider.auth.find((method) => method.id === "oauth");
|
|
const apiKey = provider.auth.find((method) => method.id === "api-key");
|
|
|
|
expect(provider.id).toBe("openai");
|
|
expect(provider.aliases).toEqual(["openai-codex"]);
|
|
expect(authMethodIds(provider)).toEqual(["oauth", "device-code", "api-key"]);
|
|
expect(oauth?.label).toBe("ChatGPT Login");
|
|
expect(oauth?.wizard?.choiceId).toBe("openai");
|
|
expect(oauth?.wizard?.assistantVisibility).toBe("manual-only");
|
|
expect(apiKey?.label).toBe("OpenAI API Key");
|
|
expect(apiKey?.wizard?.choiceId).toBe("openai-api-key");
|
|
});
|
|
});
|