import assert from "node:assert/strict";
import { test } from 'vitest';

import { formatModelIdentity, normalizedModelName } from "../model-identity.ts";

test("model identity: Kimi Code wire id displays as Kimi K2.6", () => {
	const model = {
		provider: "kimi-coding",
		id: "kimi-for-coding",
		name: "Kimi K2.6",
	};
	assert.equal(normalizedModelName(model), "Kimi K2.6");
	assert.equal(
		formatModelIdentity(model),
		"Kimi K2.6 (kimi-coding/kimi-for-coding)",
	);
});

test("model identity: Ollama Cloud live K2.6 id displays as Kimi K2.6", () => {
	const model = { provider: "ollama-cloud", id: "kimi-k2.6" };
	assert.equal(normalizedModelName(model), "Kimi K2.6");
	assert.equal(
		formatModelIdentity(model),
		"Kimi K2.6 (ollama-cloud/kimi-k2.6)",
	);
});

test("model identity: K2.5 remains distinct from K2.6", () => {
	const model = { provider: "opencode-go", id: "kimi-k2.5" };
	assert.equal(normalizedModelName(model), "Kimi K2.5");
	assert.equal(formatModelIdentity(model), "Kimi K2.5 (opencode-go/kimi-k2.5)");
});

test("model identity: Xiaomi MiMo V2 and V2.5 lines stay distinct", () => {
	const v25Pro = { provider: "xiaomi", id: "mimo-v2.5-pro" };
	const v2Pro = { provider: "xiaomi", id: "mimo-v2-pro" };
	const openRouterOmni = { provider: "openrouter", id: "xiaomi/mimo-v2-omni" };

	assert.equal(normalizedModelName(v25Pro), "MiMo V2.5 Pro");
	assert.equal(formatModelIdentity(v25Pro), "MiMo V2.5 Pro (xiaomi/mimo-v2.5-pro)");
	assert.equal(normalizedModelName(v2Pro), "MiMo V2 Pro");
	assert.equal(formatModelIdentity(v2Pro), "MiMo V2 Pro (xiaomi/mimo-v2-pro)");
	assert.equal(normalizedModelName(openRouterOmni), "MiMo V2 Omni");
	assert.equal(
		formatModelIdentity(openRouterOmni),
		"MiMo V2 Omni (openrouter/xiaomi/mimo-v2-omni)",
	);
});
