Add package summary banner
This commit is contained in:
27
resources/js/admin/mobile/lib/packageSummary.test.ts
Normal file
27
resources/js/admin/mobile/lib/packageSummary.test.ts
Normal 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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user