mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 14:16:43 +00:00
- unify CLIPROXY_SUPPORTED_PROVIDERS to import from CLIPROXY_PROVIDER_IDS - replace 4 inline union types with CLIProxyProvider import - replace hardcoded provider arrays in migration-manager and proxy-routes - remove duplicate PROVIDER_DISPLAY_NAMES, use getProviderDisplayName() - sync test now imports from ui/src/lib/provider-config instead of hardcoded array Adding a new CLIProxy provider no longer requires updating 14+ hardcoded lists.
30 lines
922 B
TypeScript
30 lines
922 B
TypeScript
/**
|
|
* Provider Sync Test
|
|
*
|
|
* Validates that backend CLIPROXY_PROFILES and UI CLIPROXY_PROVIDERS stay in sync.
|
|
* This test catches mismatches when adding new providers.
|
|
*/
|
|
|
|
import { describe, expect, test } from 'bun:test';
|
|
import { CLIPROXY_PROFILES } from '../../../src/auth/profile-detector';
|
|
import { CLIPROXY_PROVIDERS } from '../../../ui/src/lib/provider-config';
|
|
|
|
describe('Provider Sync', () => {
|
|
test('backend CLIPROXY_PROFILES matches UI CLIPROXY_PROVIDERS', () => {
|
|
const backend = [...CLIPROXY_PROFILES].sort();
|
|
const ui = [...CLIPROXY_PROVIDERS].sort();
|
|
|
|
expect(backend).toEqual(ui);
|
|
});
|
|
|
|
test('both arrays have same length', () => {
|
|
expect(CLIPROXY_PROFILES.length).toBe(CLIPROXY_PROVIDERS.length);
|
|
});
|
|
|
|
test('UI array contains all backend providers', () => {
|
|
for (const provider of CLIPROXY_PROFILES) {
|
|
expect(CLIPROXY_PROVIDERS).toContain(provider);
|
|
}
|
|
});
|
|
});
|