Skip to content

Commit

Permalink
Improve test coverage for catch-error-name (#34)
Browse files Browse the repository at this point in the history
* Improve test coverage for `catch-error-name`

* Make sure `catch-error-name` reports multiple errors
  • Loading branch information
jfmengels authored and sindresorhus committed Jun 4, 2016
1 parent dd0f64a commit 8f97d7b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/catch-error-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ test(() => {
testCase('obj.catch(function (err) {})'),
testCase('obj.catch(function () {})'),
testCase('obj.catch(function (error) {})', 'error'),
testCase('obj.catch(function (outerError) { return obj2.catch(function (innerError) {}) })')
testCase('obj.catch(function (outerError) { return obj2.catch(function (innerError) {}) })'),
testCase('obj.catch()'),
testCase('foo(function (err) {})'),
testCase('foo().then(function (err) {})'),
testCase('foo().catch(function (err) {})')
],
invalid: [
testCase('try {} catch (error) {}', null, true),
Expand All @@ -39,7 +43,17 @@ test(() => {
testCase('obj.catch(error => {})', null, true),
testCase('obj.catch(err => {})', 'error', true),
testCase('obj.catch(function (error) {})', null, true),
testCase('obj.catch(function (err) {})', 'error', true)
testCase('obj.catch(function (err) {})', 'error', true),
{
code: `
obj.catch(error => {});
obj.catch(error => {});
`,
errors: [
{ruleId: 'catch-error-name'},
{ruleId: 'catch-error-name'}
]
}
]
});
});

0 comments on commit 8f97d7b

Please sign in to comment.