File tree 1 file changed +48
-0
lines changed
packages/core/test/lib/utils
1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -194,6 +194,54 @@ describe('mergeScopeData', () => {
194
194
} ) ;
195
195
196
196
describe ( 'applyScopeDataToEvent' , ( ) => {
197
+ it ( 'should correctly merge nested event and scope data with undefined values' , ( ) => {
198
+ const eventData : Event = {
199
+ user : {
200
+ name : 'John' ,
201
+ age : undefined ,
202
+ location : 'New York' ,
203
+ newThing : undefined ,
204
+ } ,
205
+ extra : { } ,
206
+ } ;
207
+
208
+ const scopeData : ScopeData = {
209
+ eventProcessors : [ ] ,
210
+ breadcrumbs : [ ] ,
211
+ user : {
212
+ name : 'John' ,
213
+ age : 30 ,
214
+ location : 'Vienna' ,
215
+ role : 'developer' ,
216
+ thing : undefined ,
217
+ } ,
218
+ tags : { } ,
219
+ extra : { } ,
220
+ contexts : { } ,
221
+ attachments : [ ] ,
222
+ propagationContext : { traceId : '1' , sampleRand : 0.42 } ,
223
+ sdkProcessingMetadata : { } ,
224
+ fingerprint : [ ] ,
225
+ } ;
226
+
227
+ applyScopeDataToEvent ( eventData , scopeData ) ;
228
+
229
+ // Verify merged data structure
230
+ expect ( eventData ) . toEqual ( {
231
+ user : {
232
+ name : 'John' ,
233
+ age : undefined ,
234
+ location : 'New York' ,
235
+ role : 'developer' ,
236
+ thing : undefined ,
237
+ newThing : undefined ,
238
+ } ,
239
+ extra : { } ,
240
+ breadcrumbs : undefined ,
241
+ sdkProcessingMetadata : { } ,
242
+ } ) ;
243
+ } ) ;
244
+
197
245
it ( "doesn't apply scope.transactionName to transaction events" , ( ) => {
198
246
const data : ScopeData = {
199
247
eventProcessors : [ ] ,
You can’t perform that action at this time.
0 commit comments