first commit

This commit is contained in:
wsq
2026-05-13 21:58:19 +08:00
commit 0167c66cb7
1475 changed files with 233414 additions and 0 deletions
@@ -0,0 +1,25 @@
import { describe, expect, it } from 'vitest'
import { getCompatibilityLayerBadgeLabel } from '@/app/[locale]/profile/components/api-config/provider-card/ProviderCardShell'
describe('provider card shell compatibility layer badge', () => {
const t = (key: string): string => {
if (key === 'compatibilityLayerOpenAI') return 'OpenAI 兼容层'
if (key === 'compatibilityLayerGemini') return 'Gemini 兼容层'
return key
}
it('shows OpenAI compatible layer label for openai-compatible providers', () => {
expect(getCompatibilityLayerBadgeLabel('openai-compatible:oa-1', t)).toBe('OpenAI 兼容层')
})
it('shows Gemini compatible layer label for gemini-compatible providers', () => {
expect(getCompatibilityLayerBadgeLabel('gemini-compatible:gm-1', t)).toBe('Gemini 兼容层')
})
it('does not show compatibility label for preset providers', () => {
expect(getCompatibilityLayerBadgeLabel('google', t)).toBeNull()
expect(getCompatibilityLayerBadgeLabel('ark', t)).toBeNull()
expect(getCompatibilityLayerBadgeLabel('bailian', t)).toBeNull()
expect(getCompatibilityLayerBadgeLabel('siliconflow', t)).toBeNull()
})
})