@@ -32,18 +32,21 @@ describe('[UNIT] backend connector', () => {
32
32
this . timeout ( config . getTestTimeout ( ) ) ;
33
33
34
34
let onStub ;
35
+ let destroyStub ;
35
36
36
37
beforeEach ( ( ) => {
37
38
sinon . spy ( global , 'setInterval' ) ;
38
39
sinon . spy ( global , 'clearInterval' ) ;
39
40
40
41
onStub = sinon . stub ( ) ;
42
+ destroyStub = sinon . stub ( ) ;
41
43
42
44
sinon . stub ( uninstrumentedHttp . http , 'request' ) . returns ( {
43
45
on : onStub ,
44
46
setTimeout : sinon . stub ( ) ,
45
47
end : sinon . stub ( ) ,
46
- removeAllListeners : sinon . stub ( )
48
+ removeAllListeners : sinon . stub ( ) ,
49
+ destroy : destroyStub
47
50
} ) ;
48
51
} ) ;
49
52
@@ -97,6 +100,8 @@ describe('[UNIT] backend connector', () => {
97
100
98
101
setTimeout ( onEnd , 200 ) ;
99
102
await prom ;
103
+
104
+ expect ( destroyStub . called ) . to . be . true ;
100
105
} ) ;
101
106
} ) ;
102
107
@@ -122,6 +127,8 @@ describe('[UNIT] backend connector', () => {
122
127
123
128
setTimeout ( onEnd , 200 ) ;
124
129
await prom ;
130
+
131
+ expect ( destroyStub . called ) . to . be . true ;
125
132
} ) ;
126
133
} ) ;
127
134
@@ -163,6 +170,8 @@ describe('[UNIT] backend connector', () => {
163
170
164
171
// 1 bundle req, 2 heartbeats
165
172
expect ( uninstrumentedHttp . http . request . callCount ) . to . eql ( 3 ) ;
173
+
174
+ expect ( destroyStub . called ) . to . be . true ;
166
175
} ) ;
167
176
} ) ;
168
177
@@ -224,6 +233,8 @@ describe('[UNIT] backend connector', () => {
224
233
await delay ( 250 ) ;
225
234
226
235
expect ( uninstrumentedHttp . http . request . callCount ) . to . eql ( 2 ) ;
236
+
237
+ expect ( destroyStub . called ) . to . be . true ;
227
238
} ) ;
228
239
} ) ;
229
240
} ) ;
0 commit comments