Add package summary banner
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-06 12:01:12 +01:00
parent a796973861
commit cc89cc667a
5 changed files with 204 additions and 13 deletions

View File

@@ -0,0 +1,27 @@
import { describe, expect, it } from 'vitest';
import { formatPackageLimit, getPackageFeatureLabel } from './packageSummary';
const t = (key: string, options?: Record<string, unknown> | string) => {
if (typeof options === 'string') {
return options;
}
return (options?.defaultValue as string | undefined) ?? key;
};
describe('packageSummary helpers', () => {
it('returns translated labels for known features', () => {
expect(getPackageFeatureLabel('priority_support', t)).toBe('Priority support');
});
it('falls back to raw feature key for unknown features', () => {
expect(getPackageFeatureLabel('custom_feature', t)).toBe('custom_feature');
});
it('formats unlimited package limits', () => {
expect(formatPackageLimit(null, t)).toBe('Unlimited');
});
it('formats numeric package limits', () => {
expect(formatPackageLimit(12, t)).toBe('12');
});
});