From 8f97d7b84c7f763ad3f53157cd18eceee93e0cee Mon Sep 17 00:00:00 2001 From: Jeroen Engels Date: Sat, 4 Jun 2016 14:42:59 +0200 Subject: [PATCH] Improve test coverage for `catch-error-name` (#34) * Improve test coverage for `catch-error-name` * Make sure `catch-error-name` reports multiple errors --- test/catch-error-name.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/catch-error-name.js b/test/catch-error-name.js index 73cfd72e79..3b1709f191 100644 --- a/test/catch-error-name.js +++ b/test/catch-error-name.js @@ -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), @@ -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'} + ] + } ] }); });