@@ -68,77 +68,3 @@ describe('header exclusion', () => {
6868 expect ( attributes [ 'http.request.header.b' ] ) . toBeTypeOf ( 'string' )
6969 } )
7070} )
71-
72- describe ( 'patched fetch' , ( ) => {
73- const server = setupServer (
74- http . get ( 'http://localhost:3000/ok' , ( ) => HttpResponse . json ( { message : 'ok' } ) ) ,
75- http . post ( 'http://localhost:3000/ok' , ( ) => HttpResponse . json ( { message : 'ok' } ) ) ,
76- )
77-
78- beforeAll ( ( ) => {
79- server . listen ( { onUnhandledRequest : 'error' } )
80- } )
81-
82- beforeEach ( ( ) => {
83- createTracerProvider ( {
84- serviceName : 'test-service' ,
85- serviceVersion : '1.0.0' ,
86- deploymentEnvironment : 'test' ,
87- siteUrl : 'https://example.com' ,
88- siteId : '12345' ,
89- siteName : 'example' ,
90- instrumentations : [ new FetchInstrumentation ( ) ] ,
91- } )
92- } )
93-
94- afterEach ( async ( ) => {
95- server . resetHandlers ( )
96- await shutdownTracers ( )
97- } )
98-
99- afterAll ( ( ) => {
100- server . close ( )
101- } )
102-
103- it ( 'can GET url' , async ( ) => {
104- createTracerProvider ( {
105- serviceName : 'test-service' ,
106- serviceVersion : '1.0.0' ,
107- deploymentEnvironment : 'test' ,
108- siteUrl : 'https://example.com' ,
109- siteId : '12345' ,
110- siteName : 'example' ,
111- instrumentations : [ new FetchInstrumentation ( ) ] ,
112- } )
113-
114- await expect ( fetch ( 'http://localhost:3000/ok' ) . then ( ( r ) => r . json ( ) ) ) . resolves . toEqual ( { message : 'ok' } )
115- } )
116-
117- it ( 'can POST url' , async ( ) => {
118- await expect (
119- fetch ( 'http://localhost:3000/ok' , {
120- method : 'POST' ,
121- body : JSON . stringify ( { hello : 'rabbit' } ) ,
122- headers : {
123- 'Content-Type' : 'application/json' ,
124- } ,
125- } ) . then ( ( r ) => r . json ( ) ) ,
126- ) . resolves . toEqual ( { message : 'ok' } )
127- } )
128-
129- it ( 'can GET request' , async ( ) => {
130- const req = new Request ( 'http://localhost:3000/ok' )
131- await expect ( fetch ( req ) . then ( ( r ) => r . json ( ) ) ) . resolves . toEqual ( { message : 'ok' } )
132- } )
133-
134- it ( 'can POST request' , async ( ) => {
135- const req = new Request ( 'http://localhost:3000/ok' , {
136- method : 'POST' ,
137- body : JSON . stringify ( { hello : 'rabbit' } ) ,
138- headers : {
139- 'Content-Type' : 'application/json' ,
140- } ,
141- } )
142- await expect ( fetch ( req ) . then ( ( r ) => r . json ( ) ) ) . resolves . toEqual ( { message : 'ok' } )
143- } )
144- } )
0 commit comments