Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed Apr 7, 2022
1 parent 4c74bfa commit 270ce53
Showing 1 changed file with 54 additions and 30 deletions.
84 changes: 54 additions & 30 deletions packages/core/test/lib/integrations/inboundfilters.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EventProcessor } from '@sentry/types';
import { EventProcessor, Event } from '@sentry/types';

import { InboundFilters, InboundFiltersOptions } from '../../../src/integrations/inboundfilters';

Expand Down Expand Up @@ -52,50 +52,68 @@ function createInboundFiltersEventProcessor(

// Fixtures

const MESSAGE_EVENT = {
const MESSAGE_EVENT: Event = {
message: 'captureMessage',
};

const MESSAGE_EVENT_2 = {
const MESSAGE_EVENT_2: Event = {
message: 'captureMessageSomething',
};

const MESSAGE_EVENT_WITH_STACKTRACE = {
const MESSAGE_EVENT_WITH_STACKTRACE: Event = {
message: 'wat',
stacktrace: {
// Frames are always in the reverse order, as this is how Sentry expect them to come.
// Frame that crashed is the last one, the one from awesome-analytics
frames: [
{ filename: 'https://our-side.com/js/bundle.js' },
{ filename: 'https://our-side.com/js/bundle.js' },
{ filename: 'https://awesome-analytics.io/some/file.js' },
exception: {
values: [
{
stacktrace: {
// Frames are always in the reverse order, as this is how Sentry expect them to come.
// Frame that crashed is the last one, the one from awesome-analytics
frames: [
{ filename: 'https://our-side.com/js/bundle.js' },
{ filename: 'https://our-side.com/js/bundle.js' },
{ filename: 'https://awesome-analytics.io/some/file.js' },
],
},
},
],
},
};

const MESSAGE_EVENT_WITH_ANON_LAST_FRAME = {
const MESSAGE_EVENT_WITH_ANON_LAST_FRAME: Event = {
message: 'any',
stacktrace: {
frames: [
{ filename: 'https://our-side.com/js/bundle.js' },
{ filename: 'https://awesome-analytics.io/some/file.js' },
{ filename: '<anonymous>' },
exception: {
values: [
{
stacktrace: {
frames: [
{ filename: 'https://our-side.com/js/bundle.js' },
{ filename: 'https://awesome-analytics.io/some/file.js' },
{ filename: '<anonymous>' },
],
},
},
],
},
};

const MESSAGE_EVENT_WITH_NATIVE_LAST_FRAME = {
const MESSAGE_EVENT_WITH_NATIVE_LAST_FRAME: Event = {
message: 'any',
stacktrace: {
frames: [
{ filename: 'https://our-side.com/js/bundle.js' },
{ filename: 'https://awesome-analytics.io/some/file.js' },
{ filename: '[native code]' },
exception: {
values: [
{
stacktrace: {
frames: [
{ filename: 'https://our-side.com/js/bundle.js' },
{ filename: 'https://awesome-analytics.io/some/file.js' },
{ filename: '[native code]' },
],
},
},
],
},
};

const EXCEPTION_EVENT = {
const EXCEPTION_EVENT: Event = {
exception: {
values: [
{
Expand All @@ -106,7 +124,7 @@ const EXCEPTION_EVENT = {
},
};

const EXCEPTION_EVENT_WITH_FRAMES = {
const EXCEPTION_EVENT_WITH_FRAMES: Event = {
exception: {
values: [
{
Expand All @@ -124,7 +142,7 @@ const EXCEPTION_EVENT_WITH_FRAMES = {
},
};

const SENTRY_EVENT = {
const SENTRY_EVENT: Event = {
exception: {
values: [
{
Expand All @@ -135,7 +153,7 @@ const SENTRY_EVENT = {
},
};

const SCRIPT_ERROR_EVENT = {
const SCRIPT_ERROR_EVENT: Event = {
exception: {
values: [
{
Expand All @@ -146,9 +164,15 @@ const SCRIPT_ERROR_EVENT = {
},
};

const MALFORMED_EVENT = {
stacktrace: {
frames: undefined,
const MALFORMED_EVENT: Event = {
exception: {
values: [
{
stacktrace: {
frames: undefined,
},
},
],
},
};

Expand Down

0 comments on commit 270ce53

Please sign in to comment.