toggleRawEventData.spec.jsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import React from 'react';
  2. import {mountWithTheme} from 'sentry-test/enzyme';
  3. import EventDataSection from 'app/components/events/eventDataSection';
  4. import KeyValueList from 'app/components/events/interfaces/keyValueList/keyValueList';
  5. const data = {
  6. metadata: {
  7. title: 'metadata title',
  8. type: 'metadata type',
  9. directive: 'metadata directive',
  10. uri: 'metadata uri',
  11. value: 'metadata value',
  12. message: 'metadata message',
  13. },
  14. culprit: 'culprit',
  15. };
  16. describe('EventDataSection', function () {
  17. const groupData = {
  18. ...data,
  19. level: 'error',
  20. id: 'id',
  21. };
  22. const eventData = {
  23. ...data,
  24. id: 'id',
  25. eventID: 'eventID',
  26. groupID: 'groupID',
  27. culprit: undefined,
  28. };
  29. it('renders formatted', function () {
  30. const component = mountWithTheme(
  31. <EventDataSection
  32. group={groupData}
  33. event={eventData}
  34. type="extra"
  35. title="Additional Data"
  36. raw={false}
  37. />
  38. );
  39. expect(component).toSnapshot();
  40. });
  41. it('renders raw', function () {
  42. const component = mountWithTheme(
  43. <EventDataSection
  44. group={groupData}
  45. event={eventData}
  46. type="extra"
  47. title="Additional Data"
  48. raw
  49. />
  50. );
  51. expect(component).toSnapshot();
  52. });
  53. });
  54. describe('KeyValueList', function () {
  55. const context = {
  56. somestuff: {andsomeotherstuff: 'here'},
  57. plussomeotherstuff: 'here',
  58. andthis: 0,
  59. };
  60. const extraDataArray = Object.entries(context);
  61. it('renders formatted', function () {
  62. const component = mountWithTheme(
  63. <KeyValueList data={extraDataArray} isContextData raw={false} />
  64. );
  65. expect(component).toSnapshot();
  66. });
  67. it('renders raw', function () {
  68. const component = mountWithTheme(
  69. <KeyValueList data={extraDataArray} isContextData raw />
  70. );
  71. expect(component).toSnapshot();
  72. });
  73. });