Skip to content

Commit eebb31e

Browse files
committed
test: correctly reorder tests and check default allowThen: false for catch-or-return
1 parent 4a1ff62 commit eebb31e

File tree

1 file changed

+45
-6
lines changed

1 file changed

+45
-6
lines changed

__tests__/catch-or-return.js

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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 }],
@@ -234,5 +233,45 @@ ruleTester.run('catch-or-return', rule, {
234233
code: 'frank().catch(go).someOtherMethod()',
235234
errors: [{ message: catchMessage }],
236235
},
236+
237+
// .then(null, fn)
238+
{
239+
code: 'frank().then(a).then(b).then(null, c)',
240+
errors: [{ message: catchMessage }],
241+
},
242+
{
243+
code: 'frank().then(a).then(b).then().then().then(null, doIt)',
244+
errors: [{ message: catchMessage }],
245+
},
246+
{
247+
code: 'frank().then(a).then(b).then(null, function() { /* why bother */ })',
248+
errors: [{ message: catchMessage }],
249+
},
250+
251+
// .then(fn, fn)
252+
{
253+
code: 'frank().then(a, b)',
254+
errors: [{ message: catchMessage }],
255+
},
256+
{
257+
code: 'frank().then(go).then(zam, doIt)',
258+
errors: [{ message: catchMessage }],
259+
},
260+
{
261+
code: 'frank().then(a).then(b).then(c, d)',
262+
errors: [{ message: catchMessage }],
263+
},
264+
{
265+
code: 'frank().then(go).then().then().then().then(wham, doIt)',
266+
errors: [{ message: catchMessage }],
267+
},
268+
{
269+
code: 'frank().then(go).then().then(function() {}, function() { /* why bother */ })',
270+
errors: [{ message: catchMessage }],
271+
},
272+
{
273+
code: 'frank.then(go).then(to).then(pewPew, jail)',
274+
errors: [{ message: catchMessage }],
275+
},
237276
],
238277
})

0 commit comments

Comments
 (0)