@@ -15,7 +15,7 @@ describe('Test Webhook', () => {
15
15
const webhookReturnObj = { message : 'ok' , other : 'returned' } ;
16
16
let self ;
17
17
18
- it ( 'PUT No Auth' , ( ) => {
18
+ it ( 'PUT No Auth' , ( done ) => {
19
19
const nockObj = nock ( 'http://www.example.com' )
20
20
. put ( '/test' , {
21
21
k1 : 'v1' ,
@@ -52,10 +52,11 @@ describe('Test Webhook', () => {
52
52
expect ( self . calledTwice ) . to . be . true ;
53
53
expect ( self . args [ 0 ] [ 1 ] . body ) . to . eql ( webhookReturnObj ) ;
54
54
expect ( self . args [ 1 ] [ 0 ] ) . to . eql ( 'end' ) ;
55
+ done ( ) ;
55
56
} ) ;
56
57
} ) ;
57
58
58
- it ( 'PUT Auth' , ( ) => {
59
+ it ( 'PUT Auth' , ( done ) => {
59
60
const nockObj = nock ( 'http://www.example.com' )
60
61
. put ( '/test' , {
61
62
k1 : 'v1' ,
@@ -94,10 +95,11 @@ describe('Test Webhook', () => {
94
95
expect ( self . calledTwice ) . to . be . true ;
95
96
expect ( self . args [ 0 ] [ 1 ] . body ) . to . eql ( webhookReturnObj ) ;
96
97
expect ( self . args [ 1 ] [ 0 ] ) . to . eql ( 'end' ) ;
98
+ done ( ) ;
97
99
} ) ;
98
100
} ) ;
99
101
100
- it ( 'POST and get text/html response' , ( ) => {
102
+ it ( 'POST and get text/html response' , ( done ) => {
101
103
const nockObj = nock ( 'http://www.example.com' )
102
104
. post ( '/test' , {
103
105
k1 : 'v1' ,
@@ -135,10 +137,11 @@ describe('Test Webhook', () => {
135
137
responseBody : '{"message":"ok","other":"returned"}' ,
136
138
} ) ;
137
139
expect ( self . args [ 1 ] [ 0 ] ) . to . eql ( 'end' ) ;
140
+ done ( ) ;
138
141
} ) ;
139
142
} ) ;
140
143
141
- it ( 'GET No Auth No QMark' , ( ) => {
144
+ it ( 'GET No Auth No QMark' , ( done ) => {
142
145
const nockObj = nock ( 'http://www.example.com' )
143
146
. get ( '/test?k1=v1&k2=v2' )
144
147
. reply ( 200 , webhookReturnObj ) ;
@@ -172,10 +175,11 @@ describe('Test Webhook', () => {
172
175
expect ( self . args [ 0 ] [ 0 ] ) . to . eql ( 'data' ) ;
173
176
expect ( self . args [ 0 ] [ 1 ] . body ) . to . eql ( webhookReturnObj ) ;
174
177
expect ( self . args [ 1 ] [ 0 ] ) . to . eql ( 'end' ) ;
178
+ done ( ) ;
175
179
} ) ;
176
180
} ) ;
177
181
178
- it ( 'GET Auth QMark' , ( ) => {
182
+ it ( 'GET Auth QMark' , ( done ) => {
179
183
const nockObj = nock ( 'http://www.example.com' )
180
184
. get ( '/test?k1=v1&k2=v2' )
181
185
. matchHeader ( 'X-Api-Secret' , 'theSecret' )
@@ -213,10 +217,11 @@ describe('Test Webhook', () => {
213
217
expect ( self . args [ 0 ] [ 0 ] ) . to . eql ( 'data' ) ;
214
218
expect ( self . args [ 0 ] [ 1 ] . body ) . to . eql ( webhookReturnObj ) ;
215
219
expect ( self . args [ 1 ] [ 0 ] ) . to . eql ( 'end' ) ;
220
+ done ( ) ;
216
221
} ) ;
217
222
} ) ;
218
223
219
- it ( '404' , ( ) => {
224
+ it ( '404' , ( done ) => {
220
225
const nockObj = nock ( 'http://www.example.com' )
221
226
. get ( '/test?k1=v1&k2=v2' )
222
227
. matchHeader ( 'X-Api-Secret' , 'theSecret' )
@@ -252,6 +257,7 @@ describe('Test Webhook', () => {
252
257
expect ( self . args [ 0 ] [ 0 ] ) . to . eql ( 'error' ) ;
253
258
expect ( self . args [ 0 ] [ 1 ] . message ) . to . eql ( 'Endpoint responds with 404' ) ;
254
259
expect ( self . args [ 1 ] [ 0 ] ) . to . eql ( 'end' ) ;
260
+ done ( ) ;
255
261
} ) ;
256
262
} ) ;
257
263
0 commit comments