source-parity.spec.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { PAGE_CATALOG } from './page-catalog';
  2. import { SOURCE_API_ACTIONS, SOURCE_EXTERNAL_CALLS, SOURCE_PAGE_PARITY } from './source-parity.generated';
  3. describe('uni-app source parity manifest', () => {
  4. it('keeps every original page registered exactly once', () => {
  5. const sourcePaths = SOURCE_PAGE_PARITY.map((page) => page.path).sort();
  6. const angularPaths = PAGE_CATALOG.map((page) => page.path).sort();
  7. expect(new Set(angularPaths).size).toBe(angularPaths.length);
  8. expect(angularPaths).toEqual(sourcePaths);
  9. });
  10. it('tracks the full source business surface', () => {
  11. expect(SOURCE_PAGE_PARITY.length).toBe(95);
  12. expect(SOURCE_API_ACTIONS.length).toBe(91);
  13. expect(SOURCE_API_ACTIONS).toContain('payment_cart_again');
  14. expect(SOURCE_API_ACTIONS).toContain('unit_record_update');
  15. expect(SOURCE_API_ACTIONS).toContain('user_group_usr_upgrade');
  16. });
  17. it('keeps dynamic source ranking actions and dedicated rich content rendering', () => {
  18. const ranking = PAGE_CATALOG.find((page) => page.path === 'pages/member/ranklist');
  19. const article = PAGE_CATALOG.find((page) => page.path === 'pages/home/enjoy_item');
  20. expect(ranking?.tabActions).toEqual(['ranklist_1', 'ranklist_2', 'ranklist_3', 'ranklist_4', 'ranklist_5']);
  21. expect(article?.kind).toBe('article');
  22. });
  23. it('tracks customer-service calls that bypass uni.$u.http', () => {
  24. expect(SOURCE_EXTERNAL_CALLS).toContain('bytedesk.rateDetail');
  25. expect(SOURCE_EXTERNAL_CALLS).toContain('bytedesk.rate');
  26. expect(SOURCE_EXTERNAL_CALLS).toContain('bytedesk.saveLeaveMessage');
  27. expect(PAGE_CATALOG.find((page) => page.path === 'components/bytedesk_kefu/rate')?.kind).toBe('supportFeedback');
  28. expect(PAGE_CATALOG.find((page) => page.path === 'components/bytedesk_kefu/leavemsg')?.kind).toBe('supportFeedback');
  29. });
  30. });