Files
openclaw/extensions/openai/setup-api.test.ts
T
Peter Steinberger b1c2ed7d47 fix(openai): keep setup auth choices consistent (#124729)
* fix(openai): centralize setup auth metadata

* refactor(openai): overlay auth hooks in place
2026-08-16 12:31:02 -07:00

23 lines
979 B
TypeScript

// Openai tests cover setup api plugin behavior.
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(authMethodIds(provider)).toEqual(["oauth", "device-code", "api-key"]);
expect(oauth?.label).toBe("ChatGPT Login");
expect(oauth?.wizard?.choiceId).toBe("openai");
expect(apiKey?.label).toBe("OpenAI API Key");
expect(apiKey?.wizard?.choiceId).toBe("openai-api-key");
});
});