Skip to content

Commit

Permalink
Fix dedup test
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed Apr 7, 2022
1 parent 270ce53 commit 1131a9f
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions packages/integrations/test/dedupe.test.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
import { _shouldDropEvent } from '../src/dedupe';
import { Event } from '@sentry/types';

/** JSDoc */
function clone<T>(data: T): T {
return JSON.parse(JSON.stringify(data));
}

const messageEvent = {
const messageEvent: Event = {
fingerprint: ['MrSnuffles'],
message: 'PickleRick',
stacktrace: {
frames: [
{
colno: 1,
filename: 'filename.js',
function: 'function',
lineno: 1,
},
exception: {
values: [
{
colno: 2,
filename: 'filename.js',
function: 'function',
lineno: 2,
stacktrace: {
frames: [
{
colno: 1,
filename: 'filename.js',
function: 'function',
lineno: 1,
},
{
colno: 2,
filename: 'filename.js',
function: 'function',
lineno: 2,
},
],
},
},
],
},
};
const exceptionEvent = {
const exceptionEvent: Event = {
exception: {
values: [
{
Expand Down Expand Up @@ -70,7 +77,7 @@ describe('Dedupe', () => {
it('should not drop if events have same messages, but different stacktraces', () => {
const eventA = clone(messageEvent);
const eventB = clone(messageEvent);
eventB.stacktrace.frames[0].colno = 1337;
eventB.exception.values[0].stacktrace.frames[0].colno = 1337;
expect(_shouldDropEvent(eventA, eventB)).toBe(false);
});

Expand Down

0 comments on commit 1131a9f

Please sign in to comment.