ai-cli-mcp
Version:
MCP server for AI CLI tools (Claude, Codex, and Gemini) with background process management
44 lines (36 loc) • 1.55 kB
text/typescript
import { describe, it, expect } from 'vitest';
// Test the model alias resolution logic directly
describe('Model Alias Resolution', () => {
// Define the same MODEL_ALIASES as in server.ts
const MODEL_ALIASES: Record<string, string> = {
'haiku': 'claude-3-5-haiku-20241022'
};
// Replicate the resolveModelAlias function
function resolveModelAlias(model: string): string {
return MODEL_ALIASES[model] || model;
}
it('should resolve haiku alias to full model name', () => {
expect(resolveModelAlias('haiku')).toBe('claude-3-5-haiku-20241022');
});
it('should pass through non-alias model names unchanged', () => {
expect(resolveModelAlias('sonnet')).toBe('sonnet');
expect(resolveModelAlias('opus')).toBe('opus');
expect(resolveModelAlias('claude-3-opus-20240229')).toBe('claude-3-opus-20240229');
});
it('should pass through empty strings', () => {
expect(resolveModelAlias('')).toBe('');
});
it('should be case-sensitive', () => {
// Should not resolve uppercase version
expect(resolveModelAlias('Haiku')).toBe('Haiku');
expect(resolveModelAlias('HAIKU')).toBe('HAIKU');
});
it('should handle undefined input gracefully', () => {
// TypeScript would normally prevent this, but testing for runtime safety
expect(resolveModelAlias(undefined as any)).toBe(undefined);
});
it('should handle null input gracefully', () => {
// TypeScript would normally prevent this, but testing for runtime safety
expect(resolveModelAlias(null as any)).toBe(null);
});
});