@@ -118,3 +118,128 @@ QUnit.module('hooks count', function () {
118118 assert . equal ( afterCount , 5 )
119119 } )
120120} )
121+
122+ QUnit . module ( 'default max runs' , function ( ) {
123+ const calls = [ ]
124+ const retryThrice = setup ( QUnit . test , 3 )
125+
126+ retryThrice ( 'count retries' , function ( assert , currentRun ) {
127+ calls . push ( currentRun )
128+
129+ assert . equal ( currentRun , 3 )
130+ } )
131+
132+ QUnit . test ( 'verify calls' , function ( assert ) {
133+ assert . deepEqual ( calls , [ 1 , 2 , 3 ] )
134+ } )
135+ } )
136+
137+ QUnit . module ( 'retry.todo' , function ( ) {
138+ const calls = [ ]
139+
140+ retry . todo ( 'count retries' , function ( assert , currentRun ) {
141+ calls . push ( currentRun )
142+
143+ assert . ok ( false )
144+ } )
145+
146+ QUnit . test ( 'verify calls' , function ( assert ) {
147+ assert . deepEqual ( calls , [ 1 , 2 ] )
148+ } )
149+ } )
150+
151+ QUnit . module ( 'retry.skip' , function ( ) {
152+ const calls = [ ]
153+
154+ retry . skip ( 'count retries' , function ( assert , currentRun ) {
155+ calls . push ( currentRun )
156+
157+ assert . equal ( currentRun , 2 )
158+ } )
159+
160+ QUnit . test ( 'verify calls' , function ( assert ) {
161+ assert . deepEqual ( calls , [ ] )
162+ } )
163+ } )
164+
165+ QUnit . module ( 'retry.if' , function ( ) {
166+ const calls = [ ]
167+
168+ retry . if ( 'count true retries' , true , function ( assert , currentRun ) {
169+ calls . push ( [ true , currentRun ] )
170+
171+ assert . equal ( currentRun , 2 )
172+ } )
173+
174+ retry . if ( 'count false retries' , false , function ( assert , currentRun ) {
175+ calls . push ( [ false , currentRun ] )
176+
177+ assert . equal ( currentRun , 2 )
178+ } )
179+
180+ QUnit . test ( 'verify calls' , function ( assert ) {
181+ assert . deepEqual ( calls , [ [ true , 1 ] , [ true , 2 ] ] )
182+ } )
183+ } )
184+
185+ QUnit . module ( 'retry.each' , function ( ) {
186+ const calls = [ ]
187+
188+ retry . each ( 'count retries' , [ 'A' , 'B' , 'C' ] , function ( assert , data , currentRun ) {
189+ calls . push ( [ data , currentRun ] )
190+
191+ assert . equal ( currentRun , 2 )
192+ } )
193+
194+ QUnit . test ( 'verify calls' , function ( assert ) {
195+ assert . deepEqual ( calls , [ [ 'A' , 1 ] , [ 'A' , 2 ] , [ 'B' , 1 ] , [ 'B' , 2 ] , [ 'C' , 1 ] , [ 'C' , 2 ] ] )
196+ } )
197+ } )
198+
199+ QUnit . module ( 'retry.todo.each' , function ( ) {
200+ const calls = [ ]
201+
202+ retry . todo . each ( 'count retries' , [ 'A' , 'B' , 'C' ] , function ( assert , data , currentRun ) {
203+ calls . push ( [ data , currentRun ] )
204+
205+ assert . ok ( false )
206+ } )
207+
208+ QUnit . test ( 'verify calls' , function ( assert ) {
209+ assert . deepEqual ( calls , [ [ 'A' , 1 ] , [ 'A' , 2 ] , [ 'B' , 1 ] , [ 'B' , 2 ] , [ 'C' , 1 ] , [ 'C' , 2 ] ] )
210+ } )
211+ } )
212+
213+ QUnit . module ( 'retry.skip.each' , function ( ) {
214+ const calls = [ ]
215+
216+ retry . skip . each ( 'count retries' , [ 'A' , 'B' , 'C' ] , function ( assert , data , currentRun ) {
217+ calls . push ( [ data , currentRun ] )
218+
219+ assert . equal ( currentRun , 2 )
220+ } )
221+
222+ QUnit . test ( 'verify calls' , function ( assert ) {
223+ assert . deepEqual ( calls , [ ] )
224+ } )
225+ } )
226+
227+ QUnit . module ( 'retry.if.each' , function ( ) {
228+ const calls = [ ]
229+
230+ retry . if . each ( 'count true retries' , true , [ 'A' , 'B' ] , function ( assert , data , currentRun ) {
231+ calls . push ( [ true , data , currentRun ] )
232+
233+ assert . equal ( currentRun , 2 )
234+ } )
235+
236+ retry . if . each ( 'count false retries' , false , [ 'A' , 'B' ] , function ( assert , data , currentRun ) {
237+ calls . push ( [ false , data , currentRun ] )
238+
239+ assert . equal ( currentRun , 2 )
240+ } )
241+
242+ QUnit . test ( 'verify calls' , function ( assert ) {
243+ assert . deepEqual ( calls , [ [ true , 'A' , 1 ] , [ true , 'A' , 2 ] , [ true , 'B' , 1 ] , [ true , 'B' , 2 ] ] )
244+ } )
245+ } )
0 commit comments