Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

1.5 KB
Raw Blame
import { describe, expect, it } from "vitest";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";

// Source-level parity check (#241): AntigravityToolCard must surface
// API-Key-compatible / custom OpenAI-compatible providers in its model picker.
// Those provider groups in <ModelSelectModal> are derived from `modelAliases`
// — without the prop, custom-keyed providers are silently hidden even when
// active. The fix mirrors the pattern already used by every sibling CLI tool
// card (Codex, Claude, Cline, Kilo, Droid, OpenClaw, HermesAgent).

const __dirname = dirname(fileURLToPath(import.meta.url));
const CARD_PATH = resolve(
  __dirname,
  "../../../src/app/(dashboard)/dashboard/cli-code/components/AntigravityToolCard.tsx"
);

describe("AntigravityToolCard model alias wiring", () => {
  const source = readFileSync(CARD_PATH, "utf8");

  it("declares modelAliases state", () => {
    expect(source).toMatch(/useState\(\{\}\)/);
    expect(source).toMatch(/setModelAliases/);
  });

  it("fetches /api/models/alias when expanded", () => {
    expect(source).toContain('fetch("/api/models/alias")');
    expect(source).toMatch(/fetchModelAliases\s*\(\s*\)/);
  });

  it("passes modelAliases prop to ModelSelectModal", () => {
    // Regression guard for upstream parity: the prop is what unlocks the
    // API-Key-compatible / passthrough provider groups in the picker.
    expect(source).toMatch(/modelAliases=\{modelAliases\}/);
  });
});