Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
captain-yossarian committed Nov 12, 2018
1 parent cc00be7 commit 1945162
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/lib/rules/no-else-return.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ ruleTester.run("no-else-return", rule, {
output: "function foo21() { var x = true; if (x) { return x; } if (x === false) { return false; } }",
options: [{ allowElseIf: false }],
errors: [{ messageId: "unexpected", type: "IfStatement" }]
},
{
code: "function foo() { if (true) { return bar; } else { const baz = 1; return baz; } }",
output: null,
parserOptions: { ecmaVersion: 6 },
errors: [{ messageId: "unexpected", type: "BlockStatement" }]
},
{
code: "function foo() { if (true) { return bar; } else { let baz = 1; return baz; } }",
output: null,
parserOptions: { ecmaVersion: 6 },
errors: [{ messageId: "unexpected", type: "BlockStatement" }]
}
]
});

0 comments on commit 1945162

Please sign in to comment.