mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 08:18:04 +00:00
fix(profile): handle km compatibility for legacy kimi api users
This commit is contained in:
1 parent
7efbac6c1a
commit
cf8070b5f0
17 files changed
+266
-54
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { describe, expect, it } from 'bun:test';
|
||||
import { getProfileLookupCandidates, isLegacyProfileAlias } from '../../../src/utils/profile-compat';
|
||||
|
||||
describe('profile-compat', () => {
|
||||
describe('getProfileLookupCandidates', () => {
|
||||
it('returns km candidates with legacy kimi fallback', () => {
|
||||
expect(getProfileLookupCandidates('km')).toEqual(['km', 'kimi']);
|
||||
});
|
||||
|
||||
it('keeps non-aliased profiles unchanged', () => {
|
||||
expect(getProfileLookupCandidates('glm')).toEqual(['glm']);
|
||||
});
|
||||
|
||||
it('normalizes uppercase input and still resolves aliases', () => {
|
||||
expect(getProfileLookupCandidates('KM')).toEqual(['KM', 'km', 'kimi']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isLegacyProfileAlias', () => {
|
||||
it('returns true for km -> kimi', () => {
|
||||
expect(isLegacyProfileAlias('km', 'kimi')).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false for canonical names', () => {
|
||||
expect(isLegacyProfileAlias('km', 'km')).toBe(false);
|
||||
expect(isLegacyProfileAlias('glm', 'glm')).toBe(false);
|
||||
});
|
||||
|
||||
it('returns false for unrelated names', () => {
|
||||
expect(isLegacyProfileAlias('glm', 'kimi')).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user