@@ -158,11 +158,7 @@ suite('Async', () => {
158158
159159 test ( 'Throttler' , function ( ) {
160160 let count = 0 ;
161- let factory = ( ) => {
162- return TPromise . timeout ( 0 ) . then ( ( ) => {
163- return ++ count ;
164- } ) ;
165- } ;
161+ let factory = ( ) => TPromise . wrap ( async . timeout ( 0 ) ) . then ( ( ) => ++ count ) ;
166162
167163 let throttler = new async . Throttler ( ) ;
168164
@@ -185,11 +181,7 @@ suite('Async', () => {
185181
186182 test ( 'Throttler - cancel should not cancel other promises' , function ( ) {
187183 let count = 0 ;
188- let factory = ( ) => {
189- return TPromise . timeout ( 0 ) . then ( ( ) => {
190- return ++ count ;
191- } ) ;
192- } ;
184+ let factory = ( ) => TPromise . wrap ( async . timeout ( 0 ) ) . then ( ( ) => ++ count ) ;
193185
194186 let throttler = new async . Throttler ( ) ;
195187 let p1 : TPromise ;
@@ -208,11 +200,7 @@ suite('Async', () => {
208200
209201 test ( 'Throttler - cancel the first queued promise should not cancel other promises' , function ( ) {
210202 let count = 0 ;
211- let factory = ( ) => {
212- return TPromise . timeout ( 0 ) . then ( ( ) => {
213- return ++ count ;
214- } ) ;
215- } ;
203+ let factory = ( ) => TPromise . wrap ( async . timeout ( 0 ) ) . then ( ( ) => ++ count ) ;
216204
217205 let throttler = new async . Throttler ( ) ;
218206 let p2 : TPromise ;
@@ -231,11 +219,7 @@ suite('Async', () => {
231219
232220 test ( 'Throttler - cancel in the middle should not cancel other promises' , function ( ) {
233221 let count = 0 ;
234- let factory = ( ) => {
235- return TPromise . timeout ( 0 ) . then ( ( ) => {
236- return ++ count ;
237- } ) ;
238- } ;
222+ let factory = ( ) => TPromise . wrap ( async . timeout ( 0 ) ) . then ( ( ) => ++ count ) ;
239223
240224 let throttler = new async . Throttler ( ) ;
241225 let p3 : TPromise ;
@@ -254,7 +238,7 @@ suite('Async', () => {
254238
255239 test ( 'Throttler - last factory should be the one getting called' , function ( ) {
256240 let factoryFactory = ( n : number ) => ( ) => {
257- return TPromise . timeout ( 0 ) . then ( ( ) => n ) ;
241+ return TPromise . wrap ( async . timeout ( 0 ) ) . then ( ( ) => n ) ;
258242 } ;
259243
260244 let throttler = new async . Throttler ( ) ;
@@ -465,9 +449,7 @@ suite('Async', () => {
465449 } ) ;
466450
467451 test ( 'Limiter - async' , function ( ) {
468- let factoryFactory = ( n : number ) => ( ) => {
469- return TPromise . timeout ( 0 ) . then ( ( ) => n ) ;
470- } ;
452+ let factoryFactory = ( n : number ) => ( ) => TPromise . wrap ( async . timeout ( 0 ) ) . then ( ( ) => n ) ;
471453
472454 let limiter = new async . Limiter ( 1 ) ;
473455 let promises : TPromise [ ] = [ ] ;
@@ -492,7 +474,7 @@ suite('Async', () => {
492474 let factoryFactory = ( n : number ) => ( ) => {
493475 activePromises ++ ;
494476 assert ( activePromises < 6 ) ;
495- return TPromise . timeout ( 0 ) . then ( ( ) => { activePromises -- ; return n ; } ) ;
477+ return TPromise . wrap ( async . timeout ( 0 ) ) . then ( ( ) => { activePromises -- ; return n ; } ) ;
496478 } ;
497479
498480 let limiter = new async . Limiter ( 5 ) ;
@@ -513,7 +495,7 @@ suite('Async', () => {
513495 let f1 = ( ) => TPromise . as ( true ) . then ( ( ) => syncPromise = true ) ;
514496
515497 let asyncPromise = false ;
516- let f2 = ( ) => TPromise . timeout ( 10 ) . then ( ( ) => asyncPromise = true ) ;
498+ let f2 = ( ) => TPromise . wrap ( async . timeout ( 10 ) ) . then ( ( ) => asyncPromise = true ) ;
517499
518500 assert . equal ( queue . size , 0 ) ;
519501
@@ -535,10 +517,10 @@ suite('Async', () => {
535517 let res : number [ ] = [ ] ;
536518
537519 let f1 = ( ) => TPromise . as ( true ) . then ( ( ) => res . push ( 1 ) ) ;
538- let f2 = ( ) => TPromise . timeout ( 10 ) . then ( ( ) => res . push ( 2 ) ) ;
520+ let f2 = ( ) => TPromise . wrap ( async . timeout ( 10 ) ) . then ( ( ) => res . push ( 2 ) ) ;
539521 let f3 = ( ) => TPromise . as ( true ) . then ( ( ) => res . push ( 3 ) ) ;
540- let f4 = ( ) => TPromise . timeout ( 20 ) . then ( ( ) => res . push ( 4 ) ) ;
541- let f5 = ( ) => TPromise . timeout ( 0 ) . then ( ( ) => res . push ( 5 ) ) ;
522+ let f4 = ( ) => TPromise . wrap ( async . timeout ( 20 ) ) . then ( ( ) => res . push ( 4 ) ) ;
523+ let f5 = ( ) => TPromise . wrap ( async . timeout ( 0 ) ) . then ( ( ) => res . push ( 5 ) ) ;
542524
543525 queue . queue ( f1 ) ;
544526 queue . queue ( f2 ) ;
@@ -560,10 +542,10 @@ suite('Async', () => {
560542 let error = false ;
561543
562544 let f1 = ( ) => TPromise . as ( true ) . then ( ( ) => res . push ( 1 ) ) ;
563- let f2 = ( ) => TPromise . timeout ( 10 ) . then ( ( ) => res . push ( 2 ) ) ;
545+ let f2 = ( ) => TPromise . wrap ( async . timeout ( 10 ) ) . then ( ( ) => res . push ( 2 ) ) ;
564546 let f3 = ( ) => TPromise . as ( true ) . then ( ( ) => TPromise . wrapError ( new Error ( 'error' ) ) ) ;
565- let f4 = ( ) => TPromise . timeout ( 20 ) . then ( ( ) => res . push ( 4 ) ) ;
566- let f5 = ( ) => TPromise . timeout ( 0 ) . then ( ( ) => res . push ( 5 ) ) ;
547+ let f4 = ( ) => TPromise . wrap ( async . timeout ( 20 ) ) . then ( ( ) => res . push ( 4 ) ) ;
548+ let f5 = ( ) => TPromise . wrap ( async . timeout ( 0 ) ) . then ( ( ) => res . push ( 5 ) ) ;
567549
568550 queue . queue ( f1 ) ;
569551 queue . queue ( f2 ) ;
@@ -584,10 +566,10 @@ suite('Async', () => {
584566 let res : number [ ] = [ ] ;
585567
586568 let f1 = ( ) => TPromise . as ( true ) . then ( ( ) => res . push ( 1 ) ) ;
587- let f2 = ( ) => TPromise . timeout ( 10 ) . then ( ( ) => res . push ( 2 ) ) ;
569+ let f2 = ( ) => TPromise . wrap ( async . timeout ( 10 ) ) . then ( ( ) => res . push ( 2 ) ) ;
588570 let f3 = ( ) => TPromise . as ( true ) . then ( ( ) => res . push ( 3 ) ) ;
589- let f4 = ( ) => TPromise . timeout ( 20 ) . then ( ( ) => res . push ( 4 ) ) ;
590- let f5 = ( ) => TPromise . timeout ( 0 ) . then ( ( ) => res . push ( 5 ) ) ;
571+ let f4 = ( ) => TPromise . wrap ( async . timeout ( 20 ) ) . then ( ( ) => res . push ( 4 ) ) ;
572+ let f5 = ( ) => TPromise . wrap ( async . timeout ( 0 ) ) . then ( ( ) => res . push ( 5 ) ) ;
591573
592574 return queue . queue ( f1 ) . then ( ( ) => {
593575 return queue . queue ( f2 ) . then ( ( ) => {
@@ -616,9 +598,9 @@ suite('Async', () => {
616598
617599 let res : number [ ] = [ ] ;
618600
619- let f1 = ( ) => TPromise . timeout ( 10 ) . then ( ( ) => res . push ( 2 ) ) ;
620- let f2 = ( ) => TPromise . timeout ( 20 ) . then ( ( ) => res . push ( 4 ) ) ;
621- let f3 = ( ) => TPromise . timeout ( 0 ) . then ( ( ) => res . push ( 5 ) ) ;
601+ let f1 = ( ) => TPromise . wrap ( async . timeout ( 10 ) ) . then ( ( ) => res . push ( 2 ) ) ;
602+ let f2 = ( ) => TPromise . wrap ( async . timeout ( 20 ) ) . then ( ( ) => res . push ( 4 ) ) ;
603+ let f3 = ( ) => TPromise . wrap ( async . timeout ( 0 ) ) . then ( ( ) => res . push ( 5 ) ) ;
622604
623605 const q1 = queue . queue ( f1 ) ;
624606 const q2 = queue . queue ( f2 ) ;
0 commit comments