projectSupportsReplay.spec.tsx 2.3 KB

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