getStacktraceBody.spec.jsx 838 B

12345678910111213141516171819202122232425
  1. import getStacktraceBody from 'sentry/utils/getStacktraceBody';
  2. describe('getStacktraceBody', function () {
  3. const eventException = TestStubs.EventStacktraceException({platform: 'python'});
  4. const eventMessage = TestStubs.EventStacktraceMessage({platform: 'python'});
  5. it('formats with an exception', function () {
  6. const result = getStacktraceBody(eventException);
  7. expect(result).toEqual([
  8. `Error: an error occurred
  9. File "application", line 1, in main
  10. File "application", line 2, in doThing`,
  11. ]);
  12. });
  13. it('formats with a message', function () {
  14. const result = getStacktraceBody(eventMessage);
  15. expect(result).toEqual(['Something is broken']);
  16. });
  17. it('returns empty array for empty event entries', function () {
  18. const result = getStacktraceBody({});
  19. expect(result).toEqual([]);
  20. });
  21. });