@@ -6,12 +6,39 @@ describe('transaction', () => {
66 expect ( transaction . name ) . toEqual ( 'span name' ) ;
77 } ) ;
88
9- it ( 'allows to update the name' , ( ) => {
9+ it ( 'allows to update the name via setter ' , ( ) => {
1010 const transaction = new Transaction ( { name : 'span name' } ) ;
11+ transaction . setMetadata ( { source : 'route' } ) ;
1112 expect ( transaction . name ) . toEqual ( 'span name' ) ;
1213
1314 transaction . name = 'new name' ;
1415
1516 expect ( transaction . name ) . toEqual ( 'new name' ) ;
17+ expect ( transaction . metadata . source ) . toEqual ( 'custom' ) ;
18+ } ) ;
19+
20+ it ( 'allows to update the name via setName' , ( ) => {
21+ const transaction = new Transaction ( { name : 'span name' } ) ;
22+ transaction . setMetadata ( { source : 'route' } ) ;
23+ expect ( transaction . name ) . toEqual ( 'span name' ) ;
24+
25+ transaction . setMetadata ( { source : 'route' } ) ;
26+
27+ // eslint-disable-next-line deprecation/deprecation
28+ transaction . setName ( 'new name' ) ;
29+
30+ expect ( transaction . name ) . toEqual ( 'new name' ) ;
31+ expect ( transaction . metadata . source ) . toEqual ( 'custom' ) ;
32+ } ) ;
33+
34+ it ( 'allows to update the name via updateName' , ( ) => {
35+ const transaction = new Transaction ( { name : 'span name' } ) ;
36+ transaction . setMetadata ( { source : 'route' } ) ;
37+ expect ( transaction . name ) . toEqual ( 'span name' ) ;
38+
39+ transaction . updateName ( 'new name' ) ;
40+
41+ expect ( transaction . name ) . toEqual ( 'new name' ) ;
42+ expect ( transaction . metadata . source ) . toEqual ( 'route' ) ;
1643 } ) ;
1744} ) ;
0 commit comments