@@ -84,6 +84,8 @@ describe('span', () => {
84
84
strArray : [ 'aa' , 'bb' ] ,
85
85
boolArray : [ true , false ] ,
86
86
arrayWithUndefined : [ 1 , undefined , 2 ] ,
87
+ // origin is set by default to 'manual' in the Span constructor
88
+ 'sentry.origin' : 'manual' ,
87
89
} ) ;
88
90
} ) ;
89
91
@@ -92,11 +94,12 @@ describe('span', () => {
92
94
93
95
span . setAttribute ( 'str' , 'bar' ) ;
94
96
95
- expect ( Object . keys ( span [ '_attributes' ] ) . length ) . toEqual ( 1 ) ;
97
+ // length 2 because `sentry.origin` is always set by default
98
+ expect ( Object . keys ( span [ '_attributes' ] ) . length ) . toEqual ( 2 ) ;
96
99
97
100
span . setAttribute ( 'str' , undefined ) ;
98
101
99
- expect ( Object . keys ( span [ '_attributes' ] ) . length ) . toEqual ( 0 ) ;
102
+ expect ( Object . keys ( span [ '_attributes' ] ) . length ) . toEqual ( 1 ) ;
100
103
} ) ;
101
104
102
105
it ( 'disallows invalid attribute types' , ( ) => {
@@ -119,7 +122,10 @@ describe('span', () => {
119
122
120
123
const initialAttributes = span [ '_attributes' ] ;
121
124
122
- expect ( initialAttributes ) . toEqual ( { } ) ;
125
+ expect ( initialAttributes ) . toEqual ( {
126
+ // origin is set by default to 'manual' in the Span constructor
127
+ 'sentry.origin' : 'manual' ,
128
+ } ) ;
123
129
124
130
const newAttributes = {
125
131
str : 'bar' ,
@@ -145,6 +151,7 @@ describe('span', () => {
145
151
strArray : [ 'aa' , 'bb' ] ,
146
152
boolArray : [ true , false ] ,
147
153
arrayWithUndefined : [ 1 , undefined , 2 ] ,
154
+ 'sentry.origin' : 'manual' ,
148
155
} ) ;
149
156
150
157
expect ( span [ '_attributes' ] ) . not . toBe ( newAttributes ) ;
@@ -164,6 +171,7 @@ describe('span', () => {
164
171
strArray : [ 'aa' , 'bb' ] ,
165
172
boolArray : [ true , false ] ,
166
173
arrayWithUndefined : [ 1 , undefined , 2 ] ,
174
+ 'sentry.origin' : 'manual' ,
167
175
} ) ;
168
176
} ) ;
169
177
@@ -172,11 +180,12 @@ describe('span', () => {
172
180
173
181
span . setAttribute ( 'str' , 'bar' ) ;
174
182
175
- expect ( Object . keys ( span [ '_attributes' ] ) . length ) . toEqual ( 1 ) ;
183
+ // length 2 because `sentry.origin` is always set by default
184
+ expect ( Object . keys ( span [ '_attributes' ] ) . length ) . toEqual ( 2 ) ;
176
185
177
186
span . setAttributes ( { str : undefined } ) ;
178
187
179
- expect ( Object . keys ( span [ '_attributes' ] ) . length ) . toEqual ( 0 ) ;
188
+ expect ( Object . keys ( span [ '_attributes' ] ) . length ) . toEqual ( 1 ) ;
180
189
} ) ;
181
190
} ) ;
182
191
@@ -275,24 +284,38 @@ describe('span', () => {
275
284
it ( 'works without data & attributes' , ( ) => {
276
285
const span = new Span ( ) ;
277
286
278
- expect ( span [ '_getData' ] ( ) ) . toEqual ( undefined ) ;
287
+ expect ( span [ '_getData' ] ( ) ) . toEqual ( {
288
+ // origin is set by default to 'manual' in the Span constructor
289
+ 'sentry.origin' : 'manual' ,
290
+ } ) ;
279
291
} ) ;
280
292
281
293
it ( 'works with data only' , ( ) => {
282
294
const span = new Span ( ) ;
283
295
// eslint-disable-next-line deprecation/deprecation
284
296
span . setData ( 'foo' , 'bar' ) ;
285
297
286
- expect ( span [ '_getData' ] ( ) ) . toEqual ( { foo : 'bar' } ) ;
287
- // eslint-disable-next-line deprecation/deprecation
288
- expect ( span [ '_getData' ] ( ) ) . toBe ( span . data ) ;
298
+ expect ( span [ '_getData' ] ( ) ) . toEqual ( {
299
+ foo : 'bar' ,
300
+ // origin is set by default to 'manual' in the Span constructor
301
+ 'sentry.origin' : 'manual' ,
302
+ } ) ;
303
+ expect ( span [ '_getData' ] ( ) ) . toStrictEqual ( {
304
+ // eslint-disable-next-line deprecation/deprecation
305
+ ...span . data ,
306
+ 'sentry.origin' : 'manual' ,
307
+ } ) ;
289
308
} ) ;
290
309
291
310
it ( 'works with attributes only' , ( ) => {
292
311
const span = new Span ( ) ;
293
312
span . setAttribute ( 'foo' , 'bar' ) ;
294
313
295
- expect ( span [ '_getData' ] ( ) ) . toEqual ( { foo : 'bar' } ) ;
314
+ expect ( span [ '_getData' ] ( ) ) . toEqual ( {
315
+ foo : 'bar' ,
316
+ // origin is set by default to 'manual' in the Span constructor
317
+ 'sentry.origin' : 'manual' ,
318
+ } ) ;
296
319
// eslint-disable-next-line deprecation/deprecation
297
320
expect ( span [ '_getData' ] ( ) ) . toBe ( span . attributes ) ;
298
321
} ) ;
@@ -306,7 +329,13 @@ describe('span', () => {
306
329
// eslint-disable-next-line deprecation/deprecation
307
330
span . setData ( 'baz' , 'baz' ) ;
308
331
309
- expect ( span [ '_getData' ] ( ) ) . toEqual ( { foo : 'foo' , bar : 'bar' , baz : 'baz' } ) ;
332
+ expect ( span [ '_getData' ] ( ) ) . toEqual ( {
333
+ foo : 'foo' ,
334
+ bar : 'bar' ,
335
+ baz : 'baz' ,
336
+ // origin is set by default to 'manual' in the Span constructor
337
+ 'sentry.origin' : 'manual' ,
338
+ } ) ;
310
339
// eslint-disable-next-line deprecation/deprecation
311
340
expect ( span [ '_getData' ] ( ) ) . not . toBe ( span . attributes ) ;
312
341
// eslint-disable-next-line deprecation/deprecation
0 commit comments