mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { AI_PROVIDER_PRESETS } from './aiProviderPresets';
|
|
|
|
describe('AI Provider Presets', () => {
|
|
it('should export preset providers array', () => {
|
|
expect(AI_PROVIDER_PRESETS).toBeDefined();
|
|
expect(Array.isArray(AI_PROVIDER_PRESETS)).toBe(true);
|
|
expect(AI_PROVIDER_PRESETS.length).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('should include Shakespeare provider', () => {
|
|
const shakespeare = AI_PROVIDER_PRESETS.find(p => p.id === 'shakespeare');
|
|
expect(shakespeare).toBeDefined();
|
|
expect(shakespeare?.name).toBe('Shakespeare AI');
|
|
expect(shakespeare?.nostr).toBe(true);
|
|
});
|
|
|
|
it('should include other major providers', () => {
|
|
const providerIds = AI_PROVIDER_PRESETS.map(p => p.id);
|
|
expect(providerIds).toContain('openai');
|
|
expect(providerIds).toContain('openrouter');
|
|
});
|
|
|
|
it('should get preset provider by id', () => {
|
|
const openai = AI_PROVIDER_PRESETS.find(p => p.id === 'openai');
|
|
expect(openai).toBeDefined();
|
|
expect(openai?.name).toBe('OpenAI');
|
|
|
|
const nonExistent = AI_PROVIDER_PRESETS.find(p => p.id === 'non-existent');
|
|
expect(nonExistent).toBeUndefined();
|
|
});
|
|
|
|
it('should have valid preset structure', () => {
|
|
AI_PROVIDER_PRESETS.forEach(preset => {
|
|
expect(preset.id).toBeDefined();
|
|
expect(typeof preset.id).toBe('string');
|
|
expect(preset.name).toBeDefined();
|
|
expect(typeof preset.name).toBe('string');
|
|
expect(preset.baseURL).toBeDefined();
|
|
expect(typeof preset.baseURL).toBe('string');
|
|
expect(preset.baseURL).toMatch(/^https?:\/\//);
|
|
|
|
// Optional fields
|
|
if (preset.apiKeysURL) {
|
|
expect(typeof preset.apiKeysURL).toBe('string');
|
|
expect(preset.apiKeysURL).toMatch(/^https?:\/\//);
|
|
}
|
|
if (preset.nostr !== undefined) {
|
|
expect(typeof preset.nostr).toBe('boolean');
|
|
}
|
|
});
|
|
});
|
|
}); |