16
16
17
17
import * as assert from 'assert' ;
18
18
import {
19
- createBaggage ,
20
- setBaggage ,
21
- getBaggage ,
22
19
ROOT_CONTEXT ,
20
+ propagation ,
23
21
baggageEntryMetadataFromString ,
24
22
} from '../../src' ;
25
23
26
24
describe ( 'Baggage' , ( ) => {
27
25
describe ( 'create' , ( ) => {
28
26
it ( 'should create an empty bag' , ( ) => {
29
- const bag = createBaggage ( ) ;
27
+ const bag = propagation . createBaggage ( ) ;
30
28
31
29
assert . deepStrictEqual ( bag . getAllEntries ( ) , [ ] ) ;
32
30
} ) ;
33
31
34
32
it ( 'should create a bag with entries' , ( ) => {
35
33
const meta = baggageEntryMetadataFromString ( 'opaque string' ) ;
36
- const bag = createBaggage ( {
34
+ const bag = propagation . createBaggage ( {
37
35
key1 : { value : 'value1' } ,
38
36
key2 : { value : 'value2' , metadata : meta } ,
39
37
} ) ;
@@ -47,7 +45,9 @@ describe('Baggage', () => {
47
45
48
46
describe ( 'get' , ( ) => {
49
47
it ( 'should not allow modification of returned entries' , ( ) => {
50
- const bag = createBaggage ( ) . setEntry ( 'key' , { value : 'value' } ) ;
48
+ const bag = propagation
49
+ . createBaggage ( )
50
+ . setEntry ( 'key' , { value : 'value' } ) ;
51
51
52
52
const entry = bag . getEntry ( 'key' ) ;
53
53
assert . ok ( entry ) ;
@@ -59,7 +59,7 @@ describe('Baggage', () => {
59
59
60
60
describe ( 'set' , ( ) => {
61
61
it ( 'should create a new bag when an entry is added' , ( ) => {
62
- const bag = createBaggage ( ) ;
62
+ const bag = propagation . createBaggage ( ) ;
63
63
64
64
const bag2 = bag . setEntry ( 'key' , { value : 'value' } ) ;
65
65
@@ -73,7 +73,7 @@ describe('Baggage', () => {
73
73
74
74
describe ( 'remove' , ( ) => {
75
75
it ( 'should create a new bag when an entry is removed' , ( ) => {
76
- const bag = createBaggage ( {
76
+ const bag = propagation . createBaggage ( {
77
77
key : { value : 'value' } ,
78
78
} ) ;
79
79
@@ -87,7 +87,7 @@ describe('Baggage', () => {
87
87
} ) ;
88
88
89
89
it ( 'should create an empty bag multiple keys are removed' , ( ) => {
90
- const bag = createBaggage ( {
90
+ const bag = propagation . createBaggage ( {
91
91
key : { value : 'value' } ,
92
92
key1 : { value : 'value1' } ,
93
93
key2 : { value : 'value2' } ,
@@ -107,7 +107,7 @@ describe('Baggage', () => {
107
107
} ) ;
108
108
109
109
it ( 'should create an empty bag when it cleared' , ( ) => {
110
- const bag = createBaggage ( {
110
+ const bag = propagation . createBaggage ( {
111
111
key : { value : 'value' } ,
112
112
key1 : { value : 'value1' } ,
113
113
} ) ;
@@ -125,11 +125,11 @@ describe('Baggage', () => {
125
125
126
126
describe ( 'context' , ( ) => {
127
127
it ( 'should set and get a baggage from a context' , ( ) => {
128
- const bag = createBaggage ( ) ;
128
+ const bag = propagation . createBaggage ( ) ;
129
129
130
- const ctx = setBaggage ( ROOT_CONTEXT , bag ) ;
130
+ const ctx = propagation . setBaggage ( ROOT_CONTEXT , bag ) ;
131
131
132
- assert . strictEqual ( bag , getBaggage ( ctx ) ) ;
132
+ assert . strictEqual ( bag , propagation . getBaggage ( ctx ) ) ;
133
133
} ) ;
134
134
} ) ;
135
135
@@ -148,7 +148,7 @@ describe('Baggage', () => {
148
148
} ) ;
149
149
150
150
it ( 'should retain metadata' , ( ) => {
151
- const bag = createBaggage ( {
151
+ const bag = propagation . createBaggage ( {
152
152
key : {
153
153
value : 'value' ,
154
154
metadata : baggageEntryMetadataFromString ( 'meta' ) ,
0 commit comments