43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { PROVIDER_TYPES, PROVIDER_TYPE_INFO } from '@/lib/providers';
|
|
import {
|
|
BUILTIN_PROVIDER_TYPES,
|
|
getProviderConfig,
|
|
getProviderEnvVar,
|
|
} from '@electron/utils/provider-registry';
|
|
|
|
describe('provider metadata', () => {
|
|
it('includes ark in the frontend provider registry', () => {
|
|
expect(PROVIDER_TYPES).toContain('ark');
|
|
|
|
expect(PROVIDER_TYPE_INFO).toEqual(
|
|
expect.arrayContaining([
|
|
expect.objectContaining({
|
|
id: 'ark',
|
|
name: 'ByteDance Ark',
|
|
requiresApiKey: true,
|
|
defaultBaseUrl: 'https://ark.cn-beijing.volces.com/api/v3',
|
|
showBaseUrl: true,
|
|
showModelId: true,
|
|
}),
|
|
])
|
|
);
|
|
});
|
|
|
|
it('includes ark in the backend provider registry', () => {
|
|
expect(BUILTIN_PROVIDER_TYPES).toContain('ark');
|
|
expect(getProviderEnvVar('ark')).toBe('ARK_API_KEY');
|
|
expect(getProviderConfig('ark')).toEqual({
|
|
baseUrl: 'https://ark.cn-beijing.volces.com/api/v3',
|
|
api: 'openai-completions',
|
|
apiKeyEnv: 'ARK_API_KEY',
|
|
});
|
|
});
|
|
|
|
it('keeps builtin provider sources in sync', () => {
|
|
expect(BUILTIN_PROVIDER_TYPES).toEqual(
|
|
expect.arrayContaining(['anthropic', 'openai', 'google', 'openrouter', 'ark', 'moonshot', 'siliconflow', 'minimax-portal', 'minimax-portal-cn', 'qwen-portal', 'ollama'])
|
|
);
|
|
});
|
|
});
|