sub-app-icons.test.ts 970 B

12345678910111213141516171819202122232425262728
  1. import { describe, expect, it } from 'vitest';
  2. import { APP_ICONS } from '@/pages/sub/appIcons';
  3. import { buildSubApps } from '@/pages/sub/subPageModel';
  4. describe('APP_ICONS', () => {
  5. it('has an icon for every app the subscription page offers on every platform', () => {
  6. const apps = buildSubApps({
  7. subUrl: 'https://sub.example.com/sub/abc',
  8. sId: 'abc',
  9. subTitle: '',
  10. });
  11. const names = [...new Set(Object.values(apps).flatMap((list) => list.map((app) => app.name)))];
  12. expect(names.filter((name) => !APP_ICONS[name]?.src)).toEqual([]);
  13. });
  14. it('carries no icon for an app the page no longer offers', () => {
  15. const apps = buildSubApps({
  16. subUrl: 'https://sub.example.com/sub/abc',
  17. sId: 'abc',
  18. subTitle: '',
  19. });
  20. const offered = new Set(Object.values(apps).flatMap((list) => list.map((app) => app.name)));
  21. expect(Object.keys(APP_ICONS).filter((name) => !offered.has(name))).toEqual([]);
  22. });
  23. });