@@ -84,6 +84,8 @@ describe('span', () => {
8484 strArray : [ 'aa' , 'bb' ] ,
8585 boolArray : [ true , false ] ,
8686 arrayWithUndefined : [ 1 , undefined , 2 ] ,
87+ // origin is set by default to 'manual' in the Span constructor
88+ 'sentry.origin' : 'manual' ,
8789 } ) ;
8890 } ) ;
8991
@@ -92,11 +94,12 @@ describe('span', () => {
9294
9395 span . setAttribute ( 'str' , 'bar' ) ;
9496
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 ) ;
9699
97100 span . setAttribute ( 'str' , undefined ) ;
98101
99- expect ( Object . keys ( span [ '_attributes' ] ) . length ) . toEqual ( 0 ) ;
102+ expect ( Object . keys ( span [ '_attributes' ] ) . length ) . toEqual ( 1 ) ;
100103 } ) ;
101104
102105 it ( 'disallows invalid attribute types' , ( ) => {
@@ -119,7 +122,10 @@ describe('span', () => {
119122
120123 const initialAttributes = span [ '_attributes' ] ;
121124
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+ } ) ;
123129
124130 const newAttributes = {
125131 str : 'bar' ,
@@ -145,6 +151,7 @@ describe('span', () => {
145151 strArray : [ 'aa' , 'bb' ] ,
146152 boolArray : [ true , false ] ,
147153 arrayWithUndefined : [ 1 , undefined , 2 ] ,
154+ 'sentry.origin' : 'manual' ,
148155 } ) ;
149156
150157 expect ( span [ '_attributes' ] ) . not . toBe ( newAttributes ) ;
@@ -164,6 +171,7 @@ describe('span', () => {
164171 strArray : [ 'aa' , 'bb' ] ,
165172 boolArray : [ true , false ] ,
166173 arrayWithUndefined : [ 1 , undefined , 2 ] ,
174+ 'sentry.origin' : 'manual' ,
167175 } ) ;
168176 } ) ;
169177
@@ -172,11 +180,12 @@ describe('span', () => {
172180
173181 span . setAttribute ( 'str' , 'bar' ) ;
174182
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 ) ;
176185
177186 span . setAttributes ( { str : undefined } ) ;
178187
179- expect ( Object . keys ( span [ '_attributes' ] ) . length ) . toEqual ( 0 ) ;
188+ expect ( Object . keys ( span [ '_attributes' ] ) . length ) . toEqual ( 1 ) ;
180189 } ) ;
181190 } ) ;
182191
@@ -275,24 +284,38 @@ describe('span', () => {
275284 it ( 'works without data & attributes' , ( ) => {
276285 const span = new Span ( ) ;
277286
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+ } ) ;
279291 } ) ;
280292
281293 it ( 'works with data only' , ( ) => {
282294 const span = new Span ( ) ;
283295 // eslint-disable-next-line deprecation/deprecation
284296 span . setData ( 'foo' , 'bar' ) ;
285297
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+ } ) ;
289308 } ) ;
290309
291310 it ( 'works with attributes only' , ( ) => {
292311 const span = new Span ( ) ;
293312 span . setAttribute ( 'foo' , 'bar' ) ;
294313
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+ } ) ;
296319 // eslint-disable-next-line deprecation/deprecation
297320 expect ( span [ '_getData' ] ( ) ) . toBe ( span . attributes ) ;
298321 } ) ;
@@ -306,7 +329,13 @@ describe('span', () => {
306329 // eslint-disable-next-line deprecation/deprecation
307330 span . setData ( 'baz' , 'baz' ) ;
308331
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+ } ) ;
310339 // eslint-disable-next-line deprecation/deprecation
311340 expect ( span [ '_getData' ] ( ) ) . not . toBe ( span . attributes ) ;
312341 // eslint-disable-next-line deprecation/deprecation
0 commit comments