mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import {EventFixture} from 'sentry-fixture/event';
|
|
import {
|
|
EventStacktraceExceptionFixture,
|
|
EventStacktraceMessageFixture,
|
|
} from 'sentry-fixture/eventStacktraceException';
|
|
|
|
import getStacktraceBody from 'sentry/utils/getStacktraceBody';
|
|
|
|
describe('getStacktraceBody', function () {
|
|
const eventException = EventStacktraceExceptionFixture({platform: 'python'});
|
|
const eventMessage = EventStacktraceMessageFixture({platform: 'python'});
|
|
|
|
it('formats with an exception', function () {
|
|
const result = getStacktraceBody(eventException);
|
|
expect(result).toEqual([
|
|
`Error: an error occurred
|
|
File "application", line 1, in main
|
|
File "application", line 2, in doThing`,
|
|
]);
|
|
});
|
|
|
|
it('formats with a message', function () {
|
|
const result = getStacktraceBody(eventMessage);
|
|
expect(result).toEqual(['Something is broken']);
|
|
});
|
|
|
|
it('returns empty array for empty event entries', function () {
|
|
const result = getStacktraceBody(EventFixture({entries: []}));
|
|
expect(result).toEqual([]);
|
|
});
|
|
});
|