@@ -30,10 +30,10 @@ function baseChannelTest(client, server) {
30
30
} ) ;
31
31
32
32
pair . server . read ( 8 ) ; // discard the protocol header
33
- var s = util . runServer ( pair . server , function ( send , await ) {
34
- conn_handshake ( send , await )
33
+ var s = util . runServer ( pair . server , function ( send , wait ) {
34
+ conn_handshake ( send , wait )
35
35
. then ( function ( ) {
36
- server ( send , await , bothDone ) ;
36
+ server ( send , wait , bothDone ) ;
37
37
} , fail ( bothDone ) ) ;
38
38
} ) ;
39
39
} ;
@@ -46,18 +46,18 @@ function channelTest(client, server) {
46
46
if ( LOG_ERRORS ) ch . on ( 'error' , console . warn ) ;
47
47
client ( ch , done , conn ) ;
48
48
} ,
49
- function ( send , await , done ) {
50
- channel_handshake ( send , await )
49
+ function ( send , wait , done ) {
50
+ channel_handshake ( send , wait )
51
51
. then ( function ( ch ) {
52
- return server ( send , await , done , ch ) ;
52
+ return server ( send , wait , done , ch ) ;
53
53
} ) . then ( null , fail ( done ) ) ; // so you can return a promise to let
54
54
// errors bubble out
55
55
}
56
56
) ;
57
57
} ;
58
58
59
- function channel_handshake ( send , await ) {
60
- return await ( defs . ChannelOpen ) ( )
59
+ function channel_handshake ( send , wait ) {
60
+ return wait ( defs . ChannelOpen ) ( )
61
61
. then ( function ( open ) {
62
62
assert . notEqual ( 0 , open . channel ) ;
63
63
send ( defs . ChannelOpenOk , { channelId : Buffer . from ( '' ) } , open . channel ) ;
@@ -91,7 +91,7 @@ test("open", channelTest(
91
91
function ( ch , done ) {
92
92
open ( ch ) . then ( succeed ( done ) , fail ( done ) ) ;
93
93
} ,
94
- function ( send , await , done ) {
94
+ function ( send , wait , done ) {
95
95
done ( ) ;
96
96
} ) ) ;
97
97
@@ -100,8 +100,8 @@ test("bad server", baseChannelTest(
100
100
var ch = new Channel ( c ) ;
101
101
open ( ch ) . then ( fail ( done ) , succeed ( done ) ) ;
102
102
} ,
103
- function ( send , await , done ) {
104
- return await ( defs . ChannelOpen ) ( )
103
+ function ( send , wait , done ) {
104
+ return wait ( defs . ChannelOpen ) ( )
105
105
. then ( function ( open ) {
106
106
send ( defs . ChannelCloseOk , { } , open . channel ) ;
107
107
} ) . then ( succeed ( done ) , fail ( done ) ) ;
@@ -117,8 +117,8 @@ test("open, close", channelTest(
117
117
} )
118
118
. then ( succeed ( done ) , fail ( done ) ) ;
119
119
} ,
120
- function ( send , await , done , ch ) {
121
- return await ( defs . ChannelClose ) ( )
120
+ function ( send , wait , done , ch ) {
121
+ return wait ( defs . ChannelClose ) ( )
122
122
. then ( function ( close ) {
123
123
send ( defs . ChannelCloseOk , { } , ch ) ;
124
124
} ) . then ( succeed ( done ) , fail ( done ) ) ;
@@ -132,13 +132,13 @@ test("server close", channelTest(
132
132
} ) ;
133
133
open ( ch ) ;
134
134
} ,
135
- function ( send , await , done , ch ) {
135
+ function ( send , wait , done , ch ) {
136
136
send ( defs . ChannelClose , {
137
137
replyText : 'Forced close' ,
138
138
replyCode : defs . constants . CHANNEL_ERROR ,
139
139
classId : 0 , methodId : 0
140
140
} , ch ) ;
141
- await ( defs . ChannelCloseOk ) ( )
141
+ wait ( defs . ChannelCloseOk ) ( )
142
142
. then ( succeed ( done ) , fail ( done ) ) ;
143
143
} ) ) ;
144
144
@@ -151,16 +151,16 @@ test("overlapping channel/server close", channelTest(
151
151
ch . closeBecause ( "Bye" , defs . constants . REPLY_SUCCESS ) ;
152
152
} , fail ( both ) ) ;
153
153
} ,
154
- function ( send , await , done , ch ) {
155
- await ( defs . ChannelClose ) ( )
154
+ function ( send , wait , done , ch ) {
155
+ wait ( defs . ChannelClose ) ( )
156
156
. then ( function ( ) {
157
157
send ( defs . ConnectionClose , {
158
158
replyText : 'Got there first' ,
159
159
replyCode : defs . constants . INTERNAL_ERROR ,
160
160
classId : 0 , methodId : 0
161
161
} , 0 ) ;
162
162
} )
163
- . then ( await ( defs . ConnectionCloseOk ) )
163
+ . then ( wait ( defs . ConnectionCloseOk ) )
164
164
. then ( succeed ( done ) , fail ( done ) ) ;
165
165
} ) ) ;
166
166
@@ -174,8 +174,8 @@ test("double close", channelTest(
174
174
} ) ;
175
175
} ) . then ( succeed ( done ) , fail ( done ) ) ;
176
176
} ,
177
- function ( send , await , done , ch ) {
178
- await ( defs . ChannelClose ) ( )
177
+ function ( send , wait , done , ch ) {
178
+ wait ( defs . ChannelClose ) ( )
179
179
. then ( function ( ) {
180
180
send ( defs . ChannelCloseOk , {
181
181
} , ch ) ;
@@ -208,16 +208,16 @@ test("RPC", channelTest(
208
208
ch . _rpc ( defs . BasicQos , fields , defs . BasicQosOk , wheeboom ) ;
209
209
} ) . then ( null , fail ( rpcLatch ) ) ;
210
210
} ,
211
- function ( send , await , done , ch ) {
211
+ function ( send , wait , done , ch ) {
212
212
function sendOk ( f ) {
213
213
send ( defs . BasicQosOk , { } , ch ) ;
214
214
}
215
215
216
- return await ( defs . BasicQos ) ( )
216
+ return wait ( defs . BasicQos ) ( )
217
217
. then ( sendOk )
218
- . then ( await ( defs . BasicQos ) )
218
+ . then ( wait ( defs . BasicQos ) )
219
219
. then ( sendOk )
220
- . then ( await ( defs . BasicQos ) )
220
+ . then ( wait ( defs . BasicQos ) )
221
221
. then ( sendOk )
222
222
. then ( succeed ( done ) , fail ( done ) ) ;
223
223
} ) ) ;
@@ -241,12 +241,12 @@ test("Bad RPC", channelTest(
241
241
} ) ;
242
242
} , fail ( errLatch ) ) ;
243
243
} ,
244
- function ( send , await , done , ch ) {
245
- return await ( ) ( )
244
+ function ( send , wait , done , ch ) {
245
+ return wait ( ) ( )
246
246
. then ( function ( ) {
247
247
send ( defs . BasicGetEmpty , { clusterId : '' } , ch ) ;
248
248
} ) // oh wait! that was wrong! expect a channel close
249
- . then ( await ( defs . ChannelClose ) )
249
+ . then ( wait ( defs . ChannelClose ) )
250
250
. then ( function ( ) {
251
251
send ( defs . ChannelCloseOk , { } , ch ) ;
252
252
} ) . then ( succeed ( done ) , fail ( done ) ) ;
@@ -284,15 +284,15 @@ test("RPC on closed channel", channelTest(
284
284
. then ( succeed ( done ) )
285
285
. catch ( fail ( done ) ) ;
286
286
} ,
287
- function ( send , await , done , ch ) {
288
- await ( defs . BasicRecover ) ( )
287
+ function ( send , wait , done , ch ) {
288
+ wait ( defs . BasicRecover ) ( )
289
289
. then ( function ( ) {
290
290
send ( defs . ChannelClose , {
291
291
replyText : 'Nuh-uh!' ,
292
292
replyCode : defs . constants . CHANNEL_ERROR ,
293
293
methodId : 0 , classId : 0
294
294
} , ch ) ;
295
- return await ( defs . ChannelCloseOk ) ;
295
+ return wait ( defs . ChannelCloseOk ) ;
296
296
} )
297
297
. then ( succeed ( done ) )
298
298
. catch ( fail ( done ) ) ;
@@ -309,10 +309,10 @@ test("publish all < single chunk threshold", channelTest(
309
309
} )
310
310
. then ( succeed ( done ) , fail ( done ) ) ;
311
311
} ,
312
- function ( send , await , done , ch ) {
313
- await ( defs . BasicPublish ) ( )
314
- . then ( await ( defs . BasicProperties ) )
315
- . then ( await ( undefined ) ) // content frame
312
+ function ( send , wait , done , ch ) {
313
+ wait ( defs . BasicPublish ) ( )
314
+ . then ( wait ( defs . BasicProperties ) )
315
+ . then ( wait ( undefined ) ) // content frame
316
316
. then ( function ( f ) {
317
317
assert . equal ( 'foobar' , f . content . toString ( ) ) ;
318
318
} ) . then ( succeed ( done ) , fail ( done ) ) ;
@@ -328,10 +328,10 @@ test("publish content > single chunk threshold", channelTest(
328
328
} , { } , Buffer . alloc ( 3000 ) ) ;
329
329
} , done ) ;
330
330
} ,
331
- function ( send , await , done , ch ) {
332
- await ( defs . BasicPublish ) ( )
333
- . then ( await ( defs . BasicProperties ) )
334
- . then ( await ( undefined ) ) // content frame
331
+ function ( send , wait , done , ch ) {
332
+ wait ( defs . BasicPublish ) ( )
333
+ . then ( wait ( defs . BasicProperties ) )
334
+ . then ( wait ( undefined ) ) // content frame
335
335
. then ( function ( f ) {
336
336
assert . equal ( 3000 , f . content . length ) ;
337
337
} ) . then ( succeed ( done ) , fail ( done ) ) ;
@@ -349,10 +349,10 @@ test("publish method & headers > threshold", channelTest(
349
349
} , Buffer . from ( 'foobar' ) ) ;
350
350
} , done ) ;
351
351
} ,
352
- function ( send , await , done , ch ) {
353
- await ( defs . BasicPublish ) ( )
354
- . then ( await ( defs . BasicProperties ) )
355
- . then ( await ( undefined ) ) // content frame
352
+ function ( send , wait , done , ch ) {
353
+ wait ( defs . BasicPublish ) ( )
354
+ . then ( wait ( defs . BasicProperties ) )
355
+ . then ( wait ( undefined ) ) // content frame
356
356
. then ( function ( f ) {
357
357
assert . equal ( 'foobar' , f . content . toString ( ) ) ;
358
358
} ) . then ( succeed ( done ) , fail ( done ) ) ;
@@ -372,11 +372,11 @@ test("publish zero-length message", channelTest(
372
372
} , { } , Buffer . alloc ( 0 ) ) ;
373
373
} , done ) ;
374
374
} ,
375
- function ( send , await , done , ch ) {
376
- await ( defs . BasicPublish ) ( )
377
- . then ( await ( defs . BasicProperties ) )
375
+ function ( send , wait , done , ch ) {
376
+ wait ( defs . BasicPublish ) ( )
377
+ . then ( wait ( defs . BasicProperties ) )
378
378
// no content frame for a zero-length message
379
- . then ( await ( defs . BasicPublish ) )
379
+ . then ( wait ( defs . BasicPublish ) )
380
380
. then ( succeed ( done ) , fail ( done ) ) ;
381
381
} ) ) ;
382
382
@@ -389,7 +389,7 @@ test("delivery", channelTest(
389
389
} , done ) ;
390
390
} ) ;
391
391
} ,
392
- function ( send , await , done , ch ) {
392
+ function ( send , wait , done , ch ) {
393
393
completes ( function ( ) {
394
394
send ( defs . BasicDeliver , DELIVER_FIELDS , ch , Buffer . from ( 'barfoo' ) ) ;
395
395
} , done ) ;
@@ -404,7 +404,7 @@ test("zero byte msg", channelTest(
404
404
} , done ) ;
405
405
} ) ;
406
406
} ,
407
- function ( send , await , done , ch ) {
407
+ function ( send , wait , done , ch ) {
408
408
completes ( function ( ) {
409
409
send ( defs . BasicDeliver , DELIVER_FIELDS , ch , Buffer . from ( '' ) ) ;
410
410
} , done ) ;
@@ -420,11 +420,11 @@ test("bad delivery", channelTest(
420
420
ch . on ( 'close' , succeed ( errorAndClose ) ) ;
421
421
open ( ch ) ;
422
422
} ,
423
- function ( send , await , done , ch ) {
423
+ function ( send , wait , done , ch ) {
424
424
send ( defs . BasicDeliver , DELIVER_FIELDS , ch ) ;
425
425
// now send another deliver without having sent the content
426
426
send ( defs . BasicDeliver , DELIVER_FIELDS , ch ) ;
427
- return await ( defs . ChannelClose ) ( )
427
+ return wait ( defs . ChannelClose ) ( )
428
428
. then ( function ( ) {
429
429
send ( defs . ChannelCloseOk , { } , ch ) ;
430
430
} ) . then ( succeed ( done ) , fail ( done ) ) ;
@@ -441,7 +441,7 @@ test("bad content send", channelTest(
441
441
} ) ;
442
442
} , done ) ;
443
443
} ,
444
- function ( send , await , done , ch ) {
444
+ function ( send , wait , done , ch ) {
445
445
done ( ) ;
446
446
} ) ) ;
447
447
@@ -457,7 +457,7 @@ test("bad properties send", channelTest(
457
457
} ) ;
458
458
} , done ) ;
459
459
} ,
460
- function ( send , await , done , ch ) {
460
+ function ( send , wait , done , ch ) {
461
461
done ( ) ;
462
462
} ) ) ;
463
463
@@ -474,9 +474,9 @@ test("bad consumer", channelTest(
474
474
ch . on ( 'close' , succeed ( errorAndClose ) ) ;
475
475
open ( ch ) ;
476
476
} ,
477
- function ( send , await , done , ch ) {
477
+ function ( send , wait , done , ch ) {
478
478
send ( defs . BasicDeliver , DELIVER_FIELDS , ch , Buffer . from ( 'barfoo' ) ) ;
479
- return await ( defs . ChannelClose ) ( )
479
+ return wait ( defs . ChannelClose ) ( )
480
480
. then ( function ( ) {
481
481
send ( defs . ChannelCloseOk , { } , ch ) ;
482
482
} ) . then ( succeed ( done ) , fail ( done ) ) ;
@@ -499,12 +499,12 @@ test("bad send in consumer", channelTest(
499
499
500
500
open ( ch ) ;
501
501
} ,
502
- function ( send , await , done , ch ) {
502
+ function ( send , wait , done , ch ) {
503
503
completes ( function ( ) {
504
504
send ( defs . BasicDeliver , DELIVER_FIELDS , ch ,
505
505
Buffer . from ( 'barfoo' ) ) ;
506
506
} , done ) ;
507
- return await ( defs . ChannelClose ) ( )
507
+ return wait ( defs . ChannelClose ) ( )
508
508
. then ( function ( ) {
509
509
send ( defs . ChannelCloseOk , { } , ch ) ;
510
510
} ) . then ( succeed ( done ) , fail ( done ) ) ;
@@ -519,7 +519,7 @@ test("return", channelTest(
519
519
} ) ;
520
520
open ( ch ) ;
521
521
} ,
522
- function ( send , await , done , ch ) {
522
+ function ( send , wait , done , ch ) {
523
523
completes ( function ( ) {
524
524
send ( defs . BasicReturn , DELIVER_FIELDS , ch , Buffer . from ( 'barfoo' ) ) ;
525
525
} , done ) ;
@@ -534,7 +534,7 @@ test("cancel", channelTest(
534
534
} ) ;
535
535
open ( ch ) ;
536
536
} ,
537
- function ( send , await , done , ch ) {
537
+ function ( send , wait , done , ch ) {
538
538
completes ( function ( ) {
539
539
send ( defs . BasicCancel , {
540
540
consumerTag : 'product of society' ,
@@ -553,7 +553,7 @@ function confirmTest(variety, Method) {
553
553
} ) ;
554
554
open ( ch ) ;
555
555
} ,
556
- function ( send , await , done , ch ) {
556
+ function ( send , wait , done , ch ) {
557
557
completes ( function ( ) {
558
558
send ( Method , {
559
559
deliveryTag : 1 ,
@@ -579,7 +579,7 @@ test("out-of-order acks", channelTest(
579
579
ch . pushConfirmCallback ( allConfirms ) ;
580
580
open ( ch ) ;
581
581
} ,
582
- function ( send , await , done , ch ) {
582
+ function ( send , wait , done , ch ) {
583
583
completes ( function ( ) {
584
584
send ( defs . BasicAck , { deliveryTag : 2 , multiple : false } , ch ) ;
585
585
send ( defs . BasicAck , { deliveryTag : 3 , multiple : false } , ch ) ;
@@ -602,7 +602,7 @@ test("not all out-of-order acks", channelTest(
602
602
} ) ;
603
603
open ( ch ) ;
604
604
} ,
605
- function ( send , await , done , ch ) {
605
+ function ( send , wait , done , ch ) {
606
606
completes ( function ( ) {
607
607
send ( defs . BasicAck , { deliveryTag : 2 , multiple : false } , ch ) ;
608
608
send ( defs . BasicAck , { deliveryTag : 1 , multiple : false } , ch ) ;
0 commit comments