import { describe, it, expect, beforeAll } from 'vitest' import { getModelCosts, getShortModelName, loadPricing } from '../src/models.js' beforeAll(async () => { await loadPricing() }) describe('getModelCosts', () => { it('does not match short canonical against longer pricing key', () => { const costs = getModelCosts('gpt-4') if (costs) { expect(costs.inputCostPerToken).not.toBe(2.5e-6) } }) it('returns correct pricing for gpt-4o vs gpt-4o-mini', () => { const mini = getModelCosts('gpt-4o-mini') const full = getModelCosts('gpt-4o') expect(mini).not.toBeNull() expect(full).not.toBeNull() expect(mini!.inputCostPerToken).toBeLessThan(full!.inputCostPerToken) }) it('returns fallback pricing for known Claude models', () => { const costs = getModelCosts('claude-opus-4-6-20260205') expect(costs).not.toBeNull() expect(costs!.inputCostPerToken).toBe(5e-6) }) }) describe('getShortModelName', () => { it('maps gpt-4o-mini correctly (not gpt-4o)', () => { expect(getShortModelName('gpt-4o-mini-2024-07-18')).toBe('GPT-4o Mini') }) it('maps gpt-4o correctly', () => { expect(getShortModelName('gpt-4o-2024-08-06')).toBe('GPT-4o') }) it('maps gpt-4.1-mini correctly (not gpt-4.1)', () => { expect(getShortModelName('gpt-4.1-mini-2025-04-14')).toBe('GPT-4.1 Mini') }) it('maps gpt-5.4-mini correctly (not gpt-5.4)', () => { expect(getShortModelName('gpt-5.4-mini')).toBe('GPT-5.4 Mini') }) it('maps claude-opus-4-6 with date suffix', () => { expect(getShortModelName('claude-opus-4-6-20260205')).toBe('Opus 4.6') }) })