mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 04:15:52 +00:00
fix(codex-quota): guard feature label type in quota windows (#1346)
This commit is contained in:
1 parent
66966f3527
commit
b71fe5dd6e
4 files changed
+32
-3
No files matched your search
+2
-2
@@ -384,8 +384,8 @@ function getCodexWindowKindFromLabel(label: string): CodexWindowKind {
|
||||
* "OmniReview" -> "OmniReview"
|
||||
* "" -> ""
|
||||
*/
|
||||
export function prettifyCodexFeatureLabel(featureLabel: string): string {
|
||||
const trimmed = (featureLabel || '').trim();
|
||||
export function prettifyCodexFeatureLabel(featureLabel: unknown): string {
|
||||
const trimmed = typeof featureLabel === 'string' ? featureLabel.trim() : '';
|
||||
if (!trimmed) return '';
|
||||
const stripped = trimmed.replace(/^GPT-[\d.]+-Codex-/i, '');
|
||||
if (stripped !== trimmed && stripped.length > 0) {
|
||||
|
||||
@@ -37,6 +37,11 @@ describe('prettifyCodexFeatureLabel', () => {
|
||||
expect(prettifyCodexFeatureLabel(' ')).toBe('');
|
||||
expect(prettifyCodexFeatureLabel(' GPT-5.3-Codex-Spark ')).toBe('Codex Spark');
|
||||
});
|
||||
|
||||
it('returns empty string for non-string input', () => {
|
||||
expect(prettifyCodexFeatureLabel({ label: 'Spark' })).toBe('');
|
||||
expect(prettifyCodexFeatureLabel(123)).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getCodexWindowKind', () => {
|
||||
|
||||
Reference in new issue
Block a user