Skip to content

Commit fc94873

Browse files
committed
fixes test
1 parent ff67dc7 commit fc94873

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

test/utils/merge.test.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,20 @@ describe('composeEventPayloadWithRepetition', () => {
7979
});
8080

8181
it('should handle delta with new fields', () => {
82+
83+
const originalEventPayload = {
84+
title: 'Original message',
85+
type: 'error',
86+
addons: JSON.stringify({ userId: 123 }),
87+
context: JSON.stringify({ sessionId: 'abc' }),
88+
};
8289
/**
8390
* Arrange
8491
*/
8592
const delta = diff({
86-
left: mockOriginalEvent.payload,
93+
left: originalEventPayload,
8794
right: {
88-
...mockOriginalEvent.payload,
95+
...originalEventPayload,
8996
release: 'v1.0.0',
9097
catcherVersion: '2.0.0',
9198
},
@@ -100,7 +107,7 @@ describe('composeEventPayloadWithRepetition', () => {
100107
/**
101108
* Act
102109
*/
103-
const result = composeEventPayloadWithRepetition(mockOriginalEvent.payload, repetition);
110+
const result = composeEventPayloadWithRepetition(originalEventPayload, repetition);
104111

105112
/**
106113
* Assert
@@ -141,6 +148,14 @@ describe('composeEventPayloadWithRepetition', () => {
141148
});
142149

143150
describe('when repetition.delta is undefined and repetition.payload is provided (old delta format)', () => {
151+
152+
const originalEventPayload = {
153+
title: 'Original message',
154+
type: 'error',
155+
addons: JSON.stringify({ userId: 123 }),
156+
context: JSON.stringify({ sessionId: 'abc' }),
157+
};
158+
144159
it('should use repetitionAssembler to merge payloads', () => {
145160
/**
146161
* Arrange
@@ -159,7 +174,7 @@ describe('composeEventPayloadWithRepetition', () => {
159174
/**
160175
* Act
161176
*/
162-
const result = composeEventPayloadWithRepetition(mockOriginalEvent.payload, repetition);
177+
const result = composeEventPayloadWithRepetition(originalEventPayload, repetition);
163178

164179
/**
165180
* Assert
@@ -175,6 +190,7 @@ describe('composeEventPayloadWithRepetition', () => {
175190
});
176191

177192
it('should handle null values in repetition payload', () => {
193+
178194
const originalEventPayload = {
179195
title: 'Original message',
180196
type: 'error',

0 commit comments

Comments
 (0)