Files
jpremill 1feea40684 feat(ui): redesign voice cockpit with clinical companion drawer, Svelte 5 migration, and Gemini 3.8 voice
- Re-architect VoiceSession into full-bleed studio cockpit with overlay slide-over companion drawer
- Eliminate width squishing defect on LiveInsightPanel and add native dark/light theme support
- Integrate authentic Google Gemini 3.8 Flash TTS with Fenrir persona and fallback audio pipeline
- Implement comprehensive Playwright E2E visual regression suite across Desktop, iPad, and iPhone (21 tests, 45 snapshots)
- Migrate core application to Svelte 5 runes (, , ) with reactive stores
- Maintain .NET 8 Azure Functions serverless endpoints and clean build hygiene
2026-09-29 23:35:05 -04:00

66 lines
2.1 KiB
TypeScript

import { describe, test, expect } from 'vitest';
import {
DEFAULT_OPENROUTER_MODEL,
DEFAULT_SUPERVISOR_MODEL,
getOpenRouterApiKey,
hasOpenRouterApiKey,
getGeminiApiKey,
hasGeminiApiKey
} from '../services/apiConfig';
describe('API Configuration & Model Defaults', () => {
test('should default to latest Google Gemini 3.8 Flash model', () => {
expect(DEFAULT_OPENROUTER_MODEL).toBe('google/gemini-3.8-flash');
expect(DEFAULT_SUPERVISOR_MODEL).toBe('google/gemini-3.8-flash');
});
test('should return trimmed explicit custom API key when provided', () => {
const key = getOpenRouterApiKey(' sk-or-v1-custom-key-12345 ');
expect(key).toBe('sk-or-v1-custom-key-12345');
});
test('should fallback to environment variable when no argument or stored setting exists', () => {
const originalEnv = process.env.OPENROUTER_API_KEY;
try {
process.env.OPENROUTER_API_KEY = 'sk-or-v1-env-fallback-key';
const key = getOpenRouterApiKey();
expect(key).toBe('sk-or-v1-env-fallback-key');
expect(hasOpenRouterApiKey()).toBe(true);
} finally {
if (originalEnv !== undefined) {
process.env.OPENROUTER_API_KEY = originalEnv;
} else {
delete process.env.OPENROUTER_API_KEY;
}
}
});
test('should return empty string when no keys are configured', () => {
const originalEnv = process.env.OPENROUTER_API_KEY;
try {
process.env.OPENROUTER_API_KEY = '';
const key = getOpenRouterApiKey('');
expect(key).toBe('');
} finally {
if (originalEnv !== undefined) {
process.env.OPENROUTER_API_KEY = originalEnv;
}
}
});
test('should resolve Google Gemini API Key from environment or explicit argument', () => {
expect(getGeminiApiKey('AIzaSyCustomKey')).toBe('AIzaSyCustomKey');
expect(hasGeminiApiKey()).toBe(true);
const originalEnv = process.env.GEMINI_API_KEY;
try {
process.env.GEMINI_API_KEY = 'AIzaSyFallbackKey';
expect(getGeminiApiKey()).toBe('AIzaSyFallbackKey');
} finally {
if (originalEnv !== undefined) {
process.env.GEMINI_API_KEY = originalEnv;
}
}
});
});