Files
fotospiel-app/resources/js/admin/mobile/lib/packageSummary.test.ts
Codex Agent cc89cc667a
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled
Add package summary banner
2026-01-06 12:01:12 +01:00

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');
});
});