@@ -53,16 +53,10 @@ ruleTester.run('catch-or-return', rule, {
5353 options : [ { allowThen : true } ] ,
5454 } ,
5555
56- // allowThen - .then(null, fn)
57- { code : 'frank().then(a, b)' , options : [ { allowThen : true } ] } ,
5856 {
5957 code : 'frank().then(a).then(b).then(null, c)' ,
6058 options : [ { allowThen : true } ] ,
6159 } ,
62- {
63- code : 'frank().then(a).then(b).then(c, d)' ,
64- options : [ { allowThen : true } ] ,
65- } ,
6660 {
6761 code : 'frank().then(a).then(b).then().then().then(null, doIt)' ,
6862 options : [ { allowThen : true } ] ,
@@ -73,10 +67,15 @@ ruleTester.run('catch-or-return', rule, {
7367 } ,
7468
7569 // allowThen - .then(fn, fn)
70+ { code : 'frank().then(a, b)' , options : [ { allowThen : true } ] } ,
7671 {
7772 code : 'frank().then(go).then(zam, doIt)' ,
7873 options : [ { allowThen : true } ] ,
7974 } ,
75+ {
76+ code : 'frank().then(a).then(b).then(c, d)' ,
77+ options : [ { allowThen : true } ] ,
78+ } ,
8079 {
8180 code : 'frank().then(go).then().then().then().then(wham, doIt)' ,
8281 options : [ { allowThen : true } ] ,
@@ -90,6 +89,37 @@ ruleTester.run('catch-or-return', rule, {
9089 options : [ { allowThen : true } ] ,
9190 } ,
9291
92+ // allowThenStrict - .then(null, fn)
93+ {
94+ code : 'frank().then(go).then(null, doIt)' ,
95+ options : [ { allowThenStrict : true } ] ,
96+ } ,
97+ {
98+ code : 'frank().then(go).then().then().then().then(null, doIt)' ,
99+ options : [ { allowThenStrict : true } ] ,
100+ } ,
101+ {
102+ code : 'frank().then(go).then().then(null, function() { /* why bother */ })' ,
103+ options : [ { allowThenStrict : true } ] ,
104+ } ,
105+ {
106+ code : 'frank.then(go).then(to).then(null, jail)' ,
107+ options : [ { allowThenStrict : true } ] ,
108+ } ,
109+
110+ {
111+ code : 'frank().then(a).then(b).then(null, c)' ,
112+ options : [ { allowThenStrict : true } ] ,
113+ } ,
114+ {
115+ code : 'frank().then(a).then(b).then().then().then(null, doIt)' ,
116+ options : [ { allowThenStrict : true } ] ,
117+ } ,
118+ {
119+ code : 'frank().then(a).then(b).then(null, function() { /* why bother */ })' ,
120+ options : [ { allowThenStrict : true } ] ,
121+ } ,
122+
93123 // allowFinally - .finally(fn)
94124 {
95125 code : 'frank().then(go).catch(doIt).finally(fn)' ,
@@ -234,5 +264,76 @@ ruleTester.run('catch-or-return', rule, {
234264 code : 'frank().catch(go).someOtherMethod()' ,
235265 errors : [ { message : catchMessage } ] ,
236266 } ,
267+
268+ // .then(null, fn)
269+ {
270+ code : 'frank().then(a).then(b).then(null, c)' ,
271+ errors : [ { message : catchMessage } ] ,
272+ } ,
273+ {
274+ code : 'frank().then(a).then(b).then().then().then(null, doIt)' ,
275+ errors : [ { message : catchMessage } ] ,
276+ } ,
277+ {
278+ code : 'frank().then(a).then(b).then(null, function() { /* why bother */ })' ,
279+ errors : [ { message : catchMessage } ] ,
280+ } ,
281+
282+ // .then(fn, fn)
283+ {
284+ code : 'frank().then(a, b)' ,
285+ errors : [ { message : catchMessage } ] ,
286+ } ,
287+ {
288+ code : 'frank().then(go).then(zam, doIt)' ,
289+ errors : [ { message : catchMessage } ] ,
290+ } ,
291+ {
292+ code : 'frank().then(a).then(b).then(c, d)' ,
293+ errors : [ { message : catchMessage } ] ,
294+ } ,
295+ {
296+ code : 'frank().then(go).then().then().then().then(wham, doIt)' ,
297+ errors : [ { message : catchMessage } ] ,
298+ } ,
299+ {
300+ code : 'frank().then(go).then().then(function() {}, function() { /* why bother */ })' ,
301+ errors : [ { message : catchMessage } ] ,
302+ } ,
303+ {
304+ code : 'frank.then(go).then(to).then(pewPew, jail)' ,
305+ errors : [ { message : catchMessage } ] ,
306+ } ,
307+
308+ {
309+ code : 'frank().then(a, b)' ,
310+ errors : [ { message : catchMessage } ] ,
311+ options : [ { allowThenStrict : true } ] ,
312+ } ,
313+ {
314+ code : 'frank().then(go).then(zam, doIt)' ,
315+ errors : [ { message : catchMessage } ] ,
316+ options : [ { allowThenStrict : true } ] ,
317+ } ,
318+ {
319+ code : 'frank().then(a).then(b).then(c, d)' ,
320+ errors : [ { message : catchMessage } ] ,
321+ options : [ { allowThenStrict : true } ] ,
322+ } ,
323+ {
324+ code : 'frank().then(go).then().then().then().then(wham, doIt)' ,
325+ errors : [ { message : catchMessage } ] ,
326+ options : [ { allowThenStrict : true } ] ,
327+ } ,
328+ {
329+ code : 'frank().then(go).then().then(function() {}, function() { /* why bother */ })' ,
330+ errors : [ { message : catchMessage } ] ,
331+ options : [ { allowThenStrict : true } ] ,
332+ } ,
333+ {
334+ code : 'frank.then(go).then(to).then(pewPew, jail)' ,
335+ errors : [ { message : catchMessage } ] ,
336+ options : [ { allowThenStrict : true } ] ,
337+ } ,
237338 ] ,
238339} )
0 commit comments