displayReprocessEventAction.spec.tsx 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import {displayReprocessEventAction} from 'sentry/utils/displayReprocessEventAction';
  2. describe('DisplayReprocessEventAction', function () {
  3. const orgFeatures = ['reprocessing-v2'];
  4. it('returns false in case of no reprocessing-v2 feature', function () {
  5. const event = TestStubs.EventStacktraceMessage();
  6. expect(displayReprocessEventAction([], event)).toBe(false);
  7. });
  8. it('returns false in case of no event', function () {
  9. expect(displayReprocessEventAction(orgFeatures)).toBe(false);
  10. });
  11. it('returns false if no exception entry is found', function () {
  12. const event = TestStubs.EventStacktraceMessage();
  13. expect(displayReprocessEventAction(orgFeatures, event)).toBe(false);
  14. });
  15. it('returns false if the event is not a mini-dump event or an Apple crash report event or a Native event', function () {
  16. const event = TestStubs.EventStacktraceException();
  17. expect(displayReprocessEventAction(orgFeatures, event)).toBe(false);
  18. });
  19. describe('returns true', function () {
  20. describe('native event', function () {
  21. describe('event with defined platform', function () {
  22. it('native', function () {
  23. const event = TestStubs.EventStacktraceException({
  24. platform: 'native',
  25. });
  26. expect(displayReprocessEventAction(orgFeatures, event)).toBe(true);
  27. });
  28. it('cocoa', function () {
  29. const event = TestStubs.EventStacktraceException({
  30. platform: 'cocoa',
  31. });
  32. expect(displayReprocessEventAction(orgFeatures, event)).toBe(true);
  33. });
  34. });
  35. describe('event with undefined platform, but stack trace has platform', function () {
  36. it('native', function () {
  37. const event = TestStubs.EventStacktraceException({
  38. platform: undefined,
  39. });
  40. event.entries[0].data.values[0].stacktrace.frames[0].platform = 'native';
  41. expect(displayReprocessEventAction(orgFeatures, event)).toBe(true);
  42. });
  43. it('cocoa', function () {
  44. const event = TestStubs.EventStacktraceException({
  45. platform: undefined,
  46. });
  47. event.entries[0].data.values[0].stacktrace.frames[0].platform = 'cocoa';
  48. expect(displayReprocessEventAction(orgFeatures, event)).toBe(true);
  49. });
  50. });
  51. });
  52. it('mini-dump event', function () {
  53. const event = TestStubs.EventStacktraceException({
  54. platform: undefined,
  55. });
  56. event.entries[0].data.values[0] = {
  57. ...event.entries[0].data.values[0],
  58. mechanism: {
  59. type: 'minidump',
  60. },
  61. };
  62. expect(displayReprocessEventAction(orgFeatures, event)).toBe(true);
  63. });
  64. it('apple crash report event', function () {
  65. const event = TestStubs.EventStacktraceException({
  66. platform: undefined,
  67. });
  68. event.entries[0].data.values[0] = {
  69. ...event.entries[0].data.values[0],
  70. mechanism: {
  71. type: 'applecrashreport',
  72. },
  73. };
  74. expect(displayReprocessEventAction(orgFeatures, event)).toBe(true);
  75. });
  76. });
  77. });