Files
openclaw/extensions/openai/setup-api.test.ts
Peter Steinberger d92b3b5cc2 refactor: unify OpenAI provider identity
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.
2026-05-30 11:48:41 +02:00

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");
});
});