File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,12 @@ global.Utils = {
120120 return this . spyToBeCalledTimesAsync ( spy , 1 , timeout ) ;
121121 } ,
122122 spyToBeCalledTimesAsync ( spy , times = 2 , timeout = 5000 ) {
123+ const verifier = function ( verifiedSpy ) {
124+ return verifiedSpy . callCount >= times ;
125+ } ;
126+ return this . spyToBeCalledWithVerifierAsync ( spy , verifier , timeout ) ;
127+ } ,
128+ spyToBeCalledWithVerifierAsync ( spy , verifier , timeout = 5000 ) {
123129 let interval ;
124130 const { resolve, reject, promise } = Promise . defer ( ) ;
125131 const timer = setTimeout ( ( ) => {
@@ -128,7 +134,7 @@ global.Utils = {
128134 } , timeout ) ;
129135
130136 interval = setInterval ( ( ) => {
131- if ( spy . callCount >= times ) {
137+ if ( verifier ( spy ) ) {
132138 clearTimeout ( timer ) ;
133139 clearInterval ( interval ) ;
134140 resolve ( ) ;
You can’t perform that action at this time.
0 commit comments