import { describe, it, expect } from 'vitest';
import { modelDisplayName, resolveClaudeModel, resolveCodexModel } from '../lib/review-models.js';
const quality = (tier) => ({
    tier,
    focus: [],
});
const codexVendor = (auth, model = null) => ({
    enabled: true,
    auth,
    model,
    effort: 'medium',
    quality: 'medium',
    timeout_sec: null,
});
const claudeVendor = (model = null, auth = 'subscription') => ({
    enabled: true,
    auth,
    model,
    effort: 'medium',
    timeout_sec: null,
});
describe('review model resolution', () => {
    it('resolves Claude models by tier', () => {
        expect(resolveClaudeModel(quality('fast'))).toBe('claude-haiku-4-5-20251001');
        expect(resolveClaudeModel(quality('balanced'))).toBe('claude-sonnet-4-6');
        expect(resolveClaudeModel(quality('thorough'))).toBe('claude-opus-4-7');
    });
    it('honors an explicit vendors.claude.model over the tier mapping', () => {
        // Regression for #176: vendors.claude.model was silently ignored.
        expect(resolveClaudeModel(quality('balanced'), claudeVendor('opus'))).toBe('opus');
        expect(resolveClaudeModel(quality('fast'), claudeVendor('claude-opus-4-7'))).toBe('claude-opus-4-7');
        // Honored under both auth modes (claude CLI accepts --model for subscription too).
        expect(resolveClaudeModel(quality('thorough'), claudeVendor('sonnet', 'api-key'))).toBe('sonnet');
    });
    it('falls back to the tier mapping when vendors.claude.model is unset', () => {
        expect(resolveClaudeModel(quality('thorough'), claudeVendor(null))).toBe('claude-opus-4-7');
    });
    it('resolves Codex API-key models by tier and configured override', () => {
        expect(resolveCodexModel(quality('fast'), codexVendor('api-key'))).toBe('gpt-4o-mini');
        expect(resolveCodexModel(quality('balanced'), codexVendor('api-key'))).toBe('o4-mini');
        expect(resolveCodexModel(quality('thorough'), codexVendor('api-key'))).toBe('o3');
        expect(resolveCodexModel(quality('thorough'), codexVendor('api-key', 'custom-model'))).toBe('custom-model');
    });
    it('uses default for Codex subscription auth', () => {
        expect(resolveCodexModel(quality('thorough'), codexVendor('subscription'))).toBe('default');
        expect(modelDisplayName('default')).toBeNull();
    });
    it('formats known model display names', () => {
        expect(modelDisplayName('claude-opus-4-7')).toBe('Opus 4.7');
        expect(modelDisplayName('claude-sonnet-4-6')).toBe('Sonnet 4.6');
        expect(modelDisplayName('claude-haiku-4-5-20251001')).toBe('Haiku 4.5');
        expect(modelDisplayName('o4-mini')).toBe('o4-mini');
        expect(modelDisplayName('o3')).toBe('o3');
        expect(modelDisplayName('gpt-4o-mini')).toBe('gpt-4o-mini');
    });
});
//# sourceMappingURL=review-models.test.js.map