28 lines
899 B
TypeScript
28 lines
899 B
TypeScript
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');
|
|
});
|
|
});
|