displayReprocessEventAction.spec.tsx 3.1 KB

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