/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { describe, it, expect } from 'vitest';
import { resolveModel, resolveClassifierModel, isGemini3Model, isGemini2Model, isCustomModel, supportsModernFeatures, isAutoModel, getDisplayString, DEFAULT_GEMINI_MODEL, PREVIEW_GEMINI_MODEL, DEFAULT_GEMINI_FLASH_MODEL, DEFAULT_GEMINI_FLASH_LITE_MODEL, supportsMultimodalFunctionResponse, GEMINI_MODEL_ALIAS_PRO, GEMINI_MODEL_ALIAS_FLASH, GEMINI_MODEL_ALIAS_AUTO, PREVIEW_GEMINI_FLASH_MODEL, PREVIEW_GEMINI_MODEL_AUTO, DEFAULT_GEMINI_MODEL_AUTO, } from './models.js';
describe('isCustomModel', () => {
    it('should return true for models not starting with gemini-', () => {
        expect(isCustomModel('testing')).toBe(true);
        expect(isCustomModel('gpt-4')).toBe(true);
        expect(isCustomModel('claude-3')).toBe(true);
    });
    it('should return false for Gemini models', () => {
        expect(isCustomModel('gemini-1.5-pro')).toBe(false);
        expect(isCustomModel('gemini-2.0-flash')).toBe(false);
        expect(isCustomModel('gemini-3-pro-preview')).toBe(false);
    });
    it('should return false for aliases that resolve to Gemini models', () => {
        expect(isCustomModel(GEMINI_MODEL_ALIAS_AUTO)).toBe(false);
        expect(isCustomModel(GEMINI_MODEL_ALIAS_PRO)).toBe(false);
    });
});
describe('supportsModernFeatures', () => {
    it('should return true for Gemini 3 models', () => {
        expect(supportsModernFeatures('gemini-3-pro-preview')).toBe(true);
        expect(supportsModernFeatures('gemini-3-flash-preview')).toBe(true);
    });
    it('should return true for custom models', () => {
        expect(supportsModernFeatures('testing')).toBe(true);
        expect(supportsModernFeatures('some-custom-model')).toBe(true);
    });
    it('should return false for older Gemini models', () => {
        expect(supportsModernFeatures('gemini-2.5-pro')).toBe(false);
        expect(supportsModernFeatures('gemini-2.5-flash')).toBe(false);
        expect(supportsModernFeatures('gemini-2.0-flash')).toBe(false);
        expect(supportsModernFeatures('gemini-1.5-pro')).toBe(false);
        expect(supportsModernFeatures('gemini-1.0-pro')).toBe(false);
    });
    it('should return true for modern aliases', () => {
        expect(supportsModernFeatures(GEMINI_MODEL_ALIAS_PRO)).toBe(true);
        expect(supportsModernFeatures(GEMINI_MODEL_ALIAS_AUTO)).toBe(true);
    });
});
describe('isGemini3Model', () => {
    it('should return true for gemini-3 models', () => {
        expect(isGemini3Model('gemini-3-pro-preview')).toBe(true);
        expect(isGemini3Model('gemini-3-flash-preview')).toBe(true);
    });
    it('should return true for aliases that resolve to Gemini 3', () => {
        expect(isGemini3Model(GEMINI_MODEL_ALIAS_AUTO)).toBe(true);
        expect(isGemini3Model(GEMINI_MODEL_ALIAS_PRO)).toBe(true);
        expect(isGemini3Model(PREVIEW_GEMINI_MODEL_AUTO)).toBe(true);
    });
    it('should return false for Gemini 2 models', () => {
        expect(isGemini3Model('gemini-2.5-pro')).toBe(false);
        expect(isGemini3Model('gemini-2.5-flash')).toBe(false);
        expect(isGemini3Model(DEFAULT_GEMINI_MODEL_AUTO)).toBe(false);
    });
    it('should return false for arbitrary strings', () => {
        expect(isGemini3Model('gpt-4')).toBe(false);
    });
});
describe('getDisplayString', () => {
    it('should return Auto (Gemini 3) for preview auto model', () => {
        expect(getDisplayString(PREVIEW_GEMINI_MODEL_AUTO)).toBe('Auto (Gemini 3)');
    });
    it('should return Auto (Gemini 2.5) for default auto model', () => {
        expect(getDisplayString(DEFAULT_GEMINI_MODEL_AUTO)).toBe('Auto (Gemini 2.5)');
    });
    it('should return concrete model name for pro alias', () => {
        expect(getDisplayString(GEMINI_MODEL_ALIAS_PRO)).toBe(PREVIEW_GEMINI_MODEL);
    });
    it('should return concrete model name for flash alias', () => {
        expect(getDisplayString(GEMINI_MODEL_ALIAS_FLASH)).toBe(PREVIEW_GEMINI_FLASH_MODEL);
    });
    it('should return the model name as is for other models', () => {
        expect(getDisplayString('custom-model')).toBe('custom-model');
        expect(getDisplayString(DEFAULT_GEMINI_FLASH_LITE_MODEL)).toBe(DEFAULT_GEMINI_FLASH_LITE_MODEL);
    });
});
describe('supportsMultimodalFunctionResponse', () => {
    it('should return true for gemini-3 model', () => {
        expect(supportsMultimodalFunctionResponse('gemini-3-pro')).toBe(true);
    });
    it('should return false for gemini-2 models', () => {
        expect(supportsMultimodalFunctionResponse('gemini-2.5-pro')).toBe(false);
        expect(supportsMultimodalFunctionResponse('gemini-2.5-flash')).toBe(false);
    });
    it('should return false for other models', () => {
        expect(supportsMultimodalFunctionResponse('some-other-model')).toBe(false);
        expect(supportsMultimodalFunctionResponse('')).toBe(false);
    });
});
describe('resolveModel', () => {
    describe('delegation logic', () => {
        it('should return the Preview Pro model when auto-gemini-3 is requested', () => {
            const model = resolveModel(PREVIEW_GEMINI_MODEL_AUTO);
            expect(model).toBe(PREVIEW_GEMINI_MODEL);
        });
        it('should return the Default Pro model when auto-gemini-2.5 is requested', () => {
            const model = resolveModel(DEFAULT_GEMINI_MODEL_AUTO);
            expect(model).toBe(DEFAULT_GEMINI_MODEL);
        });
        it('should return the requested model as-is for explicit specific models', () => {
            expect(resolveModel(DEFAULT_GEMINI_MODEL)).toBe(DEFAULT_GEMINI_MODEL);
            expect(resolveModel(DEFAULT_GEMINI_FLASH_MODEL)).toBe(DEFAULT_GEMINI_FLASH_MODEL);
            expect(resolveModel(DEFAULT_GEMINI_FLASH_LITE_MODEL)).toBe(DEFAULT_GEMINI_FLASH_LITE_MODEL);
        });
        it('should return a custom model name when requested', () => {
            const customModel = 'custom-model-v1';
            const model = resolveModel(customModel);
            expect(model).toBe(customModel);
        });
    });
});
describe('isGemini2Model', () => {
    it('should return true for gemini-2.5-pro', () => {
        expect(isGemini2Model('gemini-2.5-pro')).toBe(true);
    });
    it('should return true for gemini-2.5-flash', () => {
        expect(isGemini2Model('gemini-2.5-flash')).toBe(true);
    });
    it('should return true for gemini-2.0-flash', () => {
        expect(isGemini2Model('gemini-2.0-flash')).toBe(true);
    });
    it('should return false for gemini-1.5-pro', () => {
        expect(isGemini2Model('gemini-1.5-pro')).toBe(false);
    });
    it('should return false for gemini-3-pro', () => {
        expect(isGemini2Model('gemini-3-pro')).toBe(false);
    });
    it('should return false for arbitrary strings', () => {
        expect(isGemini2Model('gpt-4')).toBe(false);
    });
});
describe('isAutoModel', () => {
    it('should return true for "auto"', () => {
        expect(isAutoModel(GEMINI_MODEL_ALIAS_AUTO)).toBe(true);
    });
    it('should return true for "auto-gemini-3"', () => {
        expect(isAutoModel(PREVIEW_GEMINI_MODEL_AUTO)).toBe(true);
    });
    it('should return true for "auto-gemini-2.5"', () => {
        expect(isAutoModel(DEFAULT_GEMINI_MODEL_AUTO)).toBe(true);
    });
    it('should return false for concrete models', () => {
        expect(isAutoModel(DEFAULT_GEMINI_MODEL)).toBe(false);
        expect(isAutoModel(PREVIEW_GEMINI_MODEL)).toBe(false);
        expect(isAutoModel('some-random-model')).toBe(false);
    });
});
describe('resolveClassifierModel', () => {
    it('should return flash model when alias is flash', () => {
        expect(resolveClassifierModel(DEFAULT_GEMINI_MODEL_AUTO, GEMINI_MODEL_ALIAS_FLASH)).toBe(DEFAULT_GEMINI_FLASH_MODEL);
        expect(resolveClassifierModel(PREVIEW_GEMINI_MODEL_AUTO, GEMINI_MODEL_ALIAS_FLASH)).toBe(PREVIEW_GEMINI_FLASH_MODEL);
    });
    it('should return pro model when alias is pro', () => {
        expect(resolveClassifierModel(DEFAULT_GEMINI_MODEL_AUTO, GEMINI_MODEL_ALIAS_PRO)).toBe(DEFAULT_GEMINI_MODEL);
        expect(resolveClassifierModel(PREVIEW_GEMINI_MODEL_AUTO, GEMINI_MODEL_ALIAS_PRO)).toBe(PREVIEW_GEMINI_MODEL);
    });
});
//# sourceMappingURL=models.test.js.map