projectSupportsReplay.spec.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import type {PlatformKey} from 'sentry/data/platformCategories';
  2. import type {MinimalProject} from 'sentry/types';
  3. import projectSupportsReplay, {
  4. projectCanLinkToReplay,
  5. } from 'sentry/utils/replays/projectSupportsReplay';
  6. function mockProject(platform: PlatformKey): MinimalProject {
  7. return {
  8. id: '1',
  9. slug: 'test-project',
  10. platform,
  11. };
  12. }
  13. describe('projectSupportsReplay & projectCanLinkToReplay', () => {
  14. it.each([
  15. 'javascript-angular' as PlatformKey,
  16. 'javascript-nextjs' as PlatformKey,
  17. 'javascript-react' as PlatformKey,
  18. 'javascript' as PlatformKey,
  19. ])('should SUPPORT & LINK frontend platform %s', platform => {
  20. const project = mockProject(platform);
  21. expect(projectSupportsReplay(project)).toBeTruthy();
  22. expect(projectCanLinkToReplay(project)).toBeTruthy();
  23. });
  24. it.each(['javascript-angularjs' as PlatformKey])(
  25. 'should FAIL for old, unsupported frontend framework %s',
  26. platform => {
  27. const project = mockProject(platform);
  28. expect(projectSupportsReplay(project)).toBeFalsy();
  29. expect(projectCanLinkToReplay(project)).toBeFalsy();
  30. }
  31. );
  32. it.each([
  33. 'dotnet' as PlatformKey,
  34. 'java' as PlatformKey,
  35. 'node' as PlatformKey,
  36. 'php' as PlatformKey,
  37. 'rust' as PlatformKey,
  38. ])('should NOT SUPPORT but CAN LINK for Backend framework %s', platform => {
  39. const project = mockProject(platform);
  40. expect(projectSupportsReplay(project)).toBeFalsy();
  41. expect(projectCanLinkToReplay(project)).toBeTruthy();
  42. });
  43. it.each([
  44. 'apple-macos' as PlatformKey,
  45. 'electron' as PlatformKey,
  46. 'flutter' as PlatformKey,
  47. 'unity' as PlatformKey,
  48. ])('should FAIL for Desktop framework %s', platform => {
  49. const project = mockProject(platform);
  50. expect(projectSupportsReplay(project)).toBeFalsy();
  51. expect(projectCanLinkToReplay(project)).toBeFalsy();
  52. });
  53. });