@@ -13,18 +13,29 @@ describe('endpoints telemetry', () => {
13
13
const host = 'host'
14
14
15
15
describe ( 'start' , ( ) => {
16
- it ( 'should subscribe' , ( ) => {
17
- const subscribe = sinon . stub ( )
18
- const dc = { channel ( ) { return { subscribe } } }
19
- const endpoints = proxyquire ( '../../src/telemetry/endpoints' , {
20
- 'dc-polyfill' : dc
21
- } )
16
+ const subscribe = sinon . stub ( )
17
+ const dc = { channel ( ) { return { subscribe } } }
18
+ const endpoints = proxyquire ( '../../src/telemetry/endpoints' , {
19
+ 'dc-polyfill' : dc
20
+ } )
21
+
22
+ beforeEach ( ( ) => {
23
+ sinon . reset ( )
24
+ } )
22
25
26
+ it ( 'should subscribe' , ( ) => {
23
27
const config = { appsec : { apiSecurity : { endpointCollectionEnabled : true } } }
24
28
endpoints . start ( config )
25
29
26
30
expect ( subscribe ) . to . have . been . calledOnce
27
31
} )
32
+
33
+ it ( 'should not subscribe' , ( ) => {
34
+ const config = { appsec : { apiSecurity : { endpointCollectionEnabled : false } } }
35
+ endpoints . start ( config )
36
+
37
+ expect ( subscribe ) . to . not . have . been . called
38
+ } )
28
39
} )
29
40
30
41
describe ( 'on events' , ( ) => {
@@ -84,7 +95,6 @@ describe('endpoints telemetry', () => {
84
95
85
96
expect ( sendData ) . to . have . been . calledOnce
86
97
const payload = sendData . firstCall . args [ 4 ]
87
- console . log ( payload )
88
98
expect ( payload . endpoints ) . to . have . deep . members ( [
89
99
{
90
100
type : 'REST' ,
0 commit comments