Skip to content

Commit

Permalink
Fixed test case for default export
Browse files Browse the repository at this point in the history
  • Loading branch information
shashank-saxena committed Jun 7, 2018
1 parent af90030 commit f54fab9
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/rules/match-exported.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ var testCode = "var foo = 'bar';",
exportedJsxClassCode = "module.exports = class Foo { render() { return <span>Test Class</span>; } };",
exportedClassCode = "module.exports = class Foo {};",
exportedFunctionCode = "module.exports = function foo() {};",
exportUnnamedFunctionCode = "module.exports = function() {};",
exportedCalledFunctionCode = "module.exports = foo();",
exportedJsxFunctionCode = "module.exports = function foo() { return <span>Test Fn</span> };",
exportedEs6VariableCode = "export default exported;",
exportedEs6ClassCode = "export default class Foo {};",
Expand All @@ -30,13 +32,17 @@ ruleTester.run("lib/rules/match-exported", exportedRule, {
code: testCode,
filename: "<input>"
},
{
code: exportUnnamedFunctionCode,
filename: "testFile.js"
},
{
code: testCode,
filename: "/some/dir/exported.js"
},
{
code: testCallCode,
filename: "/some/dir/exported.js",
filename: "/some/dir/foo.js",
parserOptions: { ecmaVersion: 6, sourceType: "module" }
},
{
Expand All @@ -57,6 +63,10 @@ ruleTester.run("lib/rules/match-exported", exportedRule, {
code: exportedFunctionCode,
filename: "/some/dir/foo.js"
},
{
code: exportedCalledFunctionCode,
filename: "/some/dir/foo.js"
},
{
code: exportedJsxFunctionCode,
filename: "/some/dir/foo.js",
Expand Down Expand Up @@ -142,6 +152,13 @@ ruleTester.run("lib/rules/match-exported", exportedRule, {
{ message: "Filename 'bar' must match the exported name 'foo'.", column: 1, line: 1 }
]
},
{
code: exportedCalledFunctionCode,
filename: "/some/dir/bar.js",
errors: [
{ message: "Filename 'bar' must match the exported name 'foo'.", column: 1, line: 1 }
]
},
{
code: exportedJsxFunctionCode,
filename: "/some/dir/bar.js",
Expand Down

0 comments on commit f54fab9

Please sign in to comment.