import { describe, expect, it } from "vitest";
import { createDefaultModelRegistry } from "../../src/agent/defaultModels.js";

describe("default model registry", () => {
  it("uses OpenRouter model slugs for Sonnet defaults", () => {
    const models = createDefaultModelRegistry({});

    expect(models.listModels()[0]).toMatchObject({
      id: "anthropic/claude-sonnet-5",
      label: "Claude Sonnet 5",
      toolCapable: true,
    });
    expect(models.resolve(undefined, "draft")).toBe("anthropic/claude-sonnet-5");
    expect(models.resolve(undefined, "review")).toBe("anthropic/claude-sonnet-5");
  });

  it("honors ANTHROPIC_DEFAULT_SONNET_MODEL when configured", () => {
    const models = createDefaultModelRegistry({
      ANTHROPIC_DEFAULT_SONNET_MODEL: "z-ai/glm-4.7",
    });

    expect(models.listModels()[0]?.id).toBe("z-ai/glm-4.7");
    expect(models.resolve(undefined, "draft")).toBe("z-ai/glm-4.7");
  });
});
