From f54fab9442841d97206fe93517a71ba7f453cc79 Mon Sep 17 00:00:00 2001 From: Shashank Saxena Date: Fri, 1 Jun 2018 11:02:53 +0530 Subject: [PATCH] Fixed test case for default export --- test/rules/match-exported.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/rules/match-exported.js b/test/rules/match-exported.js index 3b18f72..9daee87 100644 --- a/test/rules/match-exported.js +++ b/test/rules/match-exported.js @@ -7,6 +7,8 @@ var testCode = "var foo = 'bar';", exportedJsxClassCode = "module.exports = class Foo { render() { return Test Class; } };", exportedClassCode = "module.exports = class Foo {};", exportedFunctionCode = "module.exports = function foo() {};", + exportUnnamedFunctionCode = "module.exports = function() {};", + exportedCalledFunctionCode = "module.exports = foo();", exportedJsxFunctionCode = "module.exports = function foo() { return Test Fn };", exportedEs6VariableCode = "export default exported;", exportedEs6ClassCode = "export default class Foo {};", @@ -30,13 +32,17 @@ ruleTester.run("lib/rules/match-exported", exportedRule, { code: testCode, filename: "" }, + { + 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" } }, { @@ -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", @@ -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",