From 5c62e06d0236b5080ccfb3ca2ff55407cbb414e1 Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Tue, 27 Jan 2026 22:19:19 -0500 Subject: [PATCH] fix(ui): add iFlow to PROVIDER_ASSETS + sync validation test - Add iflow.png to PROVIDER_ASSETS map - Add backend-ui-provider-arrays-sync.test.ts to catch mismatches - Addresses PR #384 review: dual source of truth + missing iFlow --- .../backend-ui-provider-arrays-sync.test.ts | 40 +++++++++++++++++++ ui/src/lib/provider-config.ts | 1 + 2 files changed, 41 insertions(+) create mode 100644 tests/unit/cliproxy/backend-ui-provider-arrays-sync.test.ts diff --git a/tests/unit/cliproxy/backend-ui-provider-arrays-sync.test.ts b/tests/unit/cliproxy/backend-ui-provider-arrays-sync.test.ts new file mode 100644 index 00000000..50f48dea --- /dev/null +++ b/tests/unit/cliproxy/backend-ui-provider-arrays-sync.test.ts @@ -0,0 +1,40 @@ +/** + * 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'; + +// UI providers (must manually sync - this test validates the sync) +const UI_CLIPROXY_PROVIDERS = [ + 'gemini', + 'codex', + 'agy', + 'qwen', + 'iflow', + 'kiro', + 'ghcp', + 'claude', +] as const; + +describe('Provider Sync', () => { + test('backend CLIPROXY_PROFILES matches UI CLIPROXY_PROVIDERS', () => { + const backend = [...CLIPROXY_PROFILES].sort(); + const ui = [...UI_CLIPROXY_PROVIDERS].sort(); + + expect(backend).toEqual(ui); + }); + + test('both arrays have same length', () => { + expect(CLIPROXY_PROFILES.length).toBe(UI_CLIPROXY_PROVIDERS.length); + }); + + test('UI array contains all backend providers', () => { + for (const provider of CLIPROXY_PROFILES) { + expect(UI_CLIPROXY_PROVIDERS).toContain(provider); + } + }); +}); diff --git a/ui/src/lib/provider-config.ts b/ui/src/lib/provider-config.ts index 0486b973..f0b8743e 100644 --- a/ui/src/lib/provider-config.ts +++ b/ui/src/lib/provider-config.ts @@ -35,6 +35,7 @@ export const PROVIDER_ASSETS: Record = { agy: '/assets/providers/agy.png', codex: '/assets/providers/openai.svg', qwen: '/assets/providers/qwen-color.svg', + iflow: '/assets/providers/iflow.png', kiro: '/assets/providers/kiro.png', ghcp: '/assets/providers/copilot.svg', claude: '/assets/providers/claude.svg',