Skip to content

Commit 7e18afd

Browse files
committed
Add more tests for prefer-both-either
1 parent ab0f3c7 commit 7e18afd

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

test/prefer-both-either.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ const prefer = {
1616
anyPass: 'either'
1717
}
1818

19-
const error = (instead, args) => ({
19+
const error = instead => ({
2020
ruleId: 'prefer-both-either',
21-
message: `Instead of \`${instead}([${args}])\`, prefer \`${prefer[instead]}(${args})\``
21+
message: `Instead of \`${instead}\`, prefer \`${prefer[instead]}\` when there are only two predicates`
2222
});
2323

2424
ruleTester.run('prefer-both-either', rule, {
@@ -35,19 +35,31 @@ ruleTester.run('prefer-both-either', rule, {
3535
invalid: [
3636
{
3737
code: 'allPass([foo, bar])',
38-
errors: [error('allPass', 'foo, bar')]
38+
errors: [error('allPass')]
3939
},
4040
{
4141
code: 'allPass([foo, bar], baz)',
42-
errors: [error('allPass', 'foo, bar')]
42+
errors: [error('allPass')]
43+
},
44+
{
45+
code: 'allPass([(foo) => !foo, function () { return false; }])',
46+
errors: [error('allPass')]
47+
},
48+
{
49+
code: 'allPass([complement(foo), complement(bar)])',
50+
errors: [error('allPass')]
4351
},
4452
{
4553
code: 'anyPass([foo, bar])',
46-
errors: [error('anyPass', 'foo, bar')]
54+
errors: [error('anyPass')]
4755
},
4856
{
4957
code: 'anyPass([foo, bar], baz)',
50-
errors: [error('anyPass', 'foo, bar')]
58+
errors: [error('anyPass')]
59+
},
60+
{
61+
code: 'anyPass([R.T, R.F])',
62+
errors: [error('anyPass')]
5163
}
5264
]
5365
});

0 commit comments

Comments
 (0)