@@ -38,8 +38,7 @@ describe('Plugin', () => {
38
38
} )
39
39
40
40
describe ( 'without configuration' , ( ) => {
41
- beforeEach ( function ( ) {
42
- // this.timeout(10000)
41
+ beforeEach ( ( ) => {
43
42
return agent . load ( 'undici' , {
44
43
service : 'test'
45
44
} )
@@ -49,6 +48,10 @@ describe('Plugin', () => {
49
48
} )
50
49
} )
51
50
51
+ afterEach ( ( ) => {
52
+ express = null
53
+ } )
54
+
52
55
withNamingSchema (
53
56
( ) => {
54
57
const app = express ( )
@@ -65,20 +68,23 @@ describe('Plugin', () => {
65
68
rawExpectedSchema . client
66
69
)
67
70
68
- it ( 'should support URL input' , done => {
71
+ it ( 'FIRST TEST FAILS BECAUSE.' , ( ) => {
72
+ } )
73
+
74
+ it ( 'should do automatic instrumentation' , function ( done ) {
69
75
const app = express ( )
70
- app . post ( '/user' , ( req , res ) => {
76
+ app . get ( '/user' , ( req , res ) => {
71
77
res . status ( 200 ) . send ( )
72
78
} )
73
79
getPort ( ) . then ( port => {
74
80
agent
75
81
. use ( traces => {
76
- expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'service' , SERVICE_NAME )
82
+ expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'service' , 'test' )
77
83
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'type' , 'http' )
78
- expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , 'POST ' )
84
+ expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , 'GET ' )
79
85
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'span.kind' , 'client' )
80
86
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'http.url' , `http://localhost:${ port } /user` )
81
- expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'http.method' , 'POST ' )
87
+ expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'http.method' , 'GET ' )
82
88
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'http.status_code' , '200' )
83
89
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'component' , 'undici' )
84
90
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'out.host' , 'localhost' )
@@ -87,29 +93,25 @@ describe('Plugin', () => {
87
93
. catch ( done )
88
94
89
95
appListener = server ( app , port , ( ) => {
90
- fetch . fetch ( new URL ( `http://localhost:${ port } /user` ) , { method : 'POST ' } )
96
+ fetch . fetch ( `http://localhost:${ port } /user` , { method : 'GET ' } )
91
97
} )
92
98
} )
93
99
} )
94
100
95
- it ( 'should do automatic instrumentation' , function ( done ) {
96
- // this.timeout(10000)
101
+ it ( 'should support URL input' , done => {
97
102
const app = express ( )
98
- // setTimeout(done, 1000)
99
- app . get ( '/user' , ( req , res ) => {
103
+ app . post ( '/user' , ( req , res ) => {
100
104
res . status ( 200 ) . send ( )
101
105
} )
102
- // setTimeout(done, 1000)
103
106
getPort ( ) . then ( port => {
104
107
agent
105
108
. use ( traces => {
106
- // console.log('traces', traces[0][0])
107
- expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'service' , 'test' )
109
+ expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'service' , SERVICE_NAME )
108
110
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'type' , 'http' )
109
- expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , 'GET ' )
111
+ expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , 'POST ' )
110
112
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'span.kind' , 'client' )
111
113
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'http.url' , `http://localhost:${ port } /user` )
112
- expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'http.method' , 'GET ' )
114
+ expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'http.method' , 'POST ' )
113
115
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'http.status_code' , '200' )
114
116
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'component' , 'undici' )
115
117
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'out.host' , 'localhost' )
@@ -118,10 +120,8 @@ describe('Plugin', () => {
118
120
. catch ( done )
119
121
120
122
appListener = server ( app , port , ( ) => {
121
- // setTimeout(done, 1000)
122
- fetch . fetch ( `http://localhost:${ port } /user` , { method : 'GET' } )
123
+ fetch . fetch ( new URL ( `http://localhost:${ port } /user` ) , { method : 'POST' } )
123
124
} )
124
- // setTimeout(() => {}, 1000)
125
125
} )
126
126
} )
127
127
0 commit comments