2026-01-08 23:17:08 +01:00
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
|
|
2026-01-26 19:04:42 +00:00
|
|
|
import type { AuthProfileStore } from "../agents/auth-profiles.js";
|
2026-01-08 23:17:08 +01:00
|
|
|
import { buildAuthChoiceOptions } from "./auth-choice-options.js";
|
|
|
|
|
|
|
|
|
|
describe("buildAuthChoiceOptions", () => {
|
2026-01-11 05:19:07 +02:00
|
|
|
it("includes GitHub Copilot", () => {
|
|
|
|
|
const store: AuthProfileStore = { version: 1, profiles: {} };
|
|
|
|
|
const options = buildAuthChoiceOptions({
|
|
|
|
|
store,
|
|
|
|
|
includeSkip: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(options.find((opt) => opt.value === "github-copilot")).toBeDefined();
|
|
|
|
|
});
|
2026-01-26 19:04:42 +00:00
|
|
|
it("includes setup-token option for Anthropic", () => {
|
2026-01-08 23:17:08 +01:00
|
|
|
const store: AuthProfileStore = { version: 1, profiles: {} };
|
|
|
|
|
const options = buildAuthChoiceOptions({
|
|
|
|
|
store,
|
|
|
|
|
includeSkip: false,
|
|
|
|
|
});
|
|
|
|
|
|
2026-01-26 19:04:42 +00:00
|
|
|
expect(options.some((opt) => opt.value === "token")).toBe(true);
|
2026-01-08 23:17:08 +01:00
|
|
|
});
|
2026-01-11 04:56:58 +01:00
|
|
|
|
|
|
|
|
it("includes Z.AI (GLM) auth choice", () => {
|
|
|
|
|
const store: AuthProfileStore = { version: 1, profiles: {} };
|
|
|
|
|
const options = buildAuthChoiceOptions({
|
|
|
|
|
store,
|
|
|
|
|
includeSkip: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(options.some((opt) => opt.value === "zai-api-key")).toBe(true);
|
|
|
|
|
});
|
2026-01-12 05:48:53 +00:00
|
|
|
|
|
|
|
|
it("includes MiniMax auth choice", () => {
|
|
|
|
|
const store: AuthProfileStore = { version: 1, profiles: {} };
|
|
|
|
|
const options = buildAuthChoiceOptions({
|
|
|
|
|
store,
|
|
|
|
|
includeSkip: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(options.some((opt) => opt.value === "minimax-api")).toBe(true);
|
2026-01-14 14:31:43 +00:00
|
|
|
expect(options.some((opt) => opt.value === "minimax-api-lightning")).toBe(true);
|
2026-01-12 05:48:53 +00:00
|
|
|
});
|
2026-01-12 06:47:52 +00:00
|
|
|
|
|
|
|
|
it("includes Moonshot auth choice", () => {
|
|
|
|
|
const store: AuthProfileStore = { version: 1, profiles: {} };
|
|
|
|
|
const options = buildAuthChoiceOptions({
|
|
|
|
|
store,
|
|
|
|
|
includeSkip: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(options.some((opt) => opt.value === "moonshot-api-key")).toBe(true);
|
2026-01-17 11:46:37 +02:00
|
|
|
expect(options.some((opt) => opt.value === "kimi-code-api-key")).toBe(true);
|
2026-01-12 06:47:52 +00:00
|
|
|
});
|
2026-01-13 00:22:03 +00:00
|
|
|
|
2026-01-16 14:40:56 +01:00
|
|
|
it("includes Vercel AI Gateway auth choice", () => {
|
|
|
|
|
const store: AuthProfileStore = { version: 1, profiles: {} };
|
|
|
|
|
const options = buildAuthChoiceOptions({
|
|
|
|
|
store,
|
|
|
|
|
includeSkip: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(options.some((opt) => opt.value === "ai-gateway-api-key")).toBe(true);
|
|
|
|
|
});
|
|
|
|
|
|
2026-01-13 00:22:03 +00:00
|
|
|
it("includes Synthetic auth choice", () => {
|
|
|
|
|
const store: AuthProfileStore = { version: 1, profiles: {} };
|
|
|
|
|
const options = buildAuthChoiceOptions({
|
|
|
|
|
store,
|
|
|
|
|
includeSkip: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(options.some((opt) => opt.value === "synthetic-api-key")).toBe(true);
|
|
|
|
|
});
|
2026-01-11 15:06:54 +01:00
|
|
|
|
|
|
|
|
it("includes Chutes OAuth auth choice", () => {
|
|
|
|
|
const store: AuthProfileStore = { version: 1, profiles: {} };
|
|
|
|
|
const options = buildAuthChoiceOptions({
|
|
|
|
|
store,
|
|
|
|
|
includeSkip: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(options.some((opt) => opt.value === "chutes")).toBe(true);
|
|
|
|
|
});
|
2026-01-17 20:20:20 +00:00
|
|
|
|
2026-01-17 20:32:20 +00:00
|
|
|
it("includes Qwen auth choice", () => {
|
2026-01-17 20:20:20 +00:00
|
|
|
const store: AuthProfileStore = { version: 1, profiles: {} };
|
|
|
|
|
const options = buildAuthChoiceOptions({
|
|
|
|
|
store,
|
|
|
|
|
includeSkip: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(options.some((opt) => opt.value === "qwen-portal")).toBe(true);
|
|
|
|
|
});
|
2026-01-08 23:17:08 +01:00
|
|
|
});
|