From c4609546c7bcd631ab1d1029012c51ba8e939048 Mon Sep 17 00:00:00 2001 From: Dominik Ferber Date: Tue, 8 Mar 2016 18:26:35 +0100 Subject: [PATCH] test(rules): add more tests to achieve higher code coverage --- lib/rules/prefer-session-equals.js | 1 - tests/lib/rules/prefer-session-equals.js | 4 ++++ tests/lib/rules/template-naming-convention.js | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/rules/prefer-session-equals.js b/lib/rules/prefer-session-equals.js index ad07da9..997c507 100644 --- a/lib/rules/prefer-session-equals.js +++ b/lib/rules/prefer-session-equals.js @@ -10,7 +10,6 @@ const isSessionGetCallExpression = node => ( node.type === 'CallExpression' && node.callee.type === 'MemberExpression' && ( - node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && node.callee.object.name === 'Session' && ( ( diff --git a/tests/lib/rules/prefer-session-equals.js b/tests/lib/rules/prefer-session-equals.js index 9ee722d..5395f4f 100644 --- a/tests/lib/rules/prefer-session-equals.js +++ b/tests/lib/rules/prefer-session-equals.js @@ -15,6 +15,10 @@ const ruleTester = new RuleTester() ruleTester.run('prefer-session-equals', rule, { valid: [ + 'var x = 1', + 'if(x()) {}', + 'if (true) {}', + 'if (Session["equals"]("foo", true)) {}', 'if (Session.equals("foo", true)) {}', 'if (Session.equals("foo", false)) {}', 'if (Session.equals("foo", 1)) {}', diff --git a/tests/lib/rules/template-naming-convention.js b/tests/lib/rules/template-naming-convention.js index 9c37e0a..f3562ec 100644 --- a/tests/lib/rules/template-naming-convention.js +++ b/tests/lib/rules/template-naming-convention.js @@ -93,6 +93,13 @@ ruleTester.run('template-naming-convention', rule, { { message: 'Invalid template naming convention, expected "camel-case"', type: 'MemberExpression' }, ], }, + { + code: 'Template.foo_bar.helpers({})', + options: ['pascal-case'], + errors: [ + { message: 'Invalid template naming convention, expected "pascal-case"', type: 'MemberExpression' }, + ], + }, { code: 'Template.fooBar.helpers({})', options: ['snake-case'],