Skip to content

Commit

Permalink
Chore: remove identical tests (#8851)
Browse files Browse the repository at this point in the history
This removes rule tests that were identical to other tests in the same file, making them completely redundant.

These cases were detected by the new [`no-identical-tests`](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/8c19ab5eb8942e35f102ca300a83ac73f67ce26f/docs/rules/no-identical-tests.md) rule in `eslint-plugin-eslint-plugin`. I'm planning to enable that rule on the codebase in a follow-up PR.
  • Loading branch information
not-an-aardvark committed Jul 1, 2017
1 parent 5c3ac8e commit 0780d86
Show file tree
Hide file tree
Showing 37 changed files with 3 additions and 361 deletions.
3 changes: 0 additions & 3 deletions tests/lib/rules/array-bracket-spacing.js
Expand Up @@ -91,7 +91,6 @@ ruleTester.run("array-bracket-spacing", rule, {
{ code: "var [ x, y\n] = z", parserOptions: { ecmaVersion: 6 }, options: ["always"] },
{ code: "var [\nx, y ] = z", parserOptions: { ecmaVersion: 6 }, options: ["always"] },
{ code: "var [\nx, y\n] = z", parserOptions: { ecmaVersion: 6 }, options: ["always"] },
{ code: "var [\nx, y\n] = z", parserOptions: { ecmaVersion: 6 }, options: ["always"] },
{ code: "var [\nx,,,\n] = z", parserOptions: { ecmaVersion: 6 }, options: ["always"] },
{ code: "var [ ,x, ] = z", parserOptions: { ecmaVersion: 6 }, options: ["always"] },
{ code: "var [\nx, ...y\n] = z", parserOptions: { ecmaVersion: 6 }, options: ["always"] },
Expand All @@ -110,7 +109,6 @@ ruleTester.run("array-bracket-spacing", rule, {
{ code: "obj.map(function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] },
{ code: "obj['map'](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] },
{ code: "obj['for' + 'Each'](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] },
{ code: "obj['for' + 'Each'](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] },
{ code: "var arr = [1, 2, 3, 4];", options: ["never"] },
{ code: "var arr = [[1, 2], 2, 3, 4];", options: ["never"] },
{ code: "var arr = [\n1, 2, 3, 4\n];", options: ["never"] },
Expand All @@ -125,7 +123,6 @@ ruleTester.run("array-bracket-spacing", rule, {
{ code: "var [x, y\n] = z", parserOptions: { ecmaVersion: 6 }, options: ["never"] },
{ code: "var [\nx, y] = z", parserOptions: { ecmaVersion: 6 }, options: ["never"] },
{ code: "var [\nx, y\n] = z", parserOptions: { ecmaVersion: 6 }, options: ["never"] },
{ code: "var [\nx, y\n] = z", parserOptions: { ecmaVersion: 6 }, options: ["never"] },
{ code: "var [\nx,,,\n] = z", parserOptions: { ecmaVersion: 6 }, options: ["never"] },
{ code: "var [,x,] = z", parserOptions: { ecmaVersion: 6 }, options: ["never"] },
{ code: "var [\nx, ...y\n] = z", parserOptions: { ecmaVersion: 6 }, options: ["never"] },
Expand Down
17 changes: 0 additions & 17 deletions tests/lib/rules/array-element-newline.js
Expand Up @@ -219,23 +219,6 @@ ruleTester.run("array-element-newline", rule, {
}
]
},
{
code: "var foo = [1,(\n2\n), 3];",
options: ["always"],
output: "var foo = [1,\n(\n2\n),\n3];",
errors: [
{
message: ERR_BREAK_HERE,
line: 1,
column: 14
},
{
message: ERR_BREAK_HERE,
line: 3,
column: 3
}
]
},
{
code: "var foo = [1, \t (\n2\n),\n3];",
options: ["always"],
Expand Down
1 change: 0 additions & 1 deletion tests/lib/rules/arrow-body-style.js
Expand Up @@ -42,7 +42,6 @@ ruleTester.run("arrow-body-style", rule, {
{ code: "var foo = (retv, name) => {\nretv[name] = true;\nreturn retv;\n};", options: ["as-needed", { requireReturnForObjectLiteral: true }] },
{ code: "var foo = () => bar();", options: ["as-needed", { requireReturnForObjectLiteral: true }] },
{ code: "var foo = () => { bar(); };", options: ["as-needed", { requireReturnForObjectLiteral: true }] },
{ code: "var addToB = (a) => { b = b + a };", options: ["as-needed", { requireReturnForObjectLiteral: true }] },
{ code: "var foo = () => { return { bar: 0 }; };", options: ["as-needed", { requireReturnForObjectLiteral: true }] }
],
invalid: [
Expand Down
5 changes: 0 additions & 5 deletions tests/lib/rules/brace-style.js
Expand Up @@ -229,11 +229,6 @@ ruleTester.run("brace-style", rule, {
output: "if (foo) { \n bar(); \n}",
errors: [{ message: OPEN_MESSAGE, type: "Punctuator" }, { message: CLOSE_MESSAGE_SINGLE, type: "Punctuator" }]
},
{
code: "if (foo) \n { \n bar(); }",
output: "if (foo) { \n bar(); \n}",
errors: [{ message: OPEN_MESSAGE, type: "Punctuator" }, { message: CLOSE_MESSAGE_SINGLE, type: "Punctuator" }]
},
{
code: "if (a) { \nb();\n } else \n { c(); }",
output: "if (a) { \nb();\n } else {\n c(); \n}",
Expand Down
10 changes: 0 additions & 10 deletions tests/lib/rules/camelcase.js
Expand Up @@ -192,16 +192,6 @@ ruleTester.run("camelcase", rule, {
}
]
},
{
code: "obj.a_b = 2;",
options: [{ properties: "always" }],
errors: [
{
message: "Identifier 'a_b' is not in camel case.",
type: "Identifier"
}
]
},
{
code: "var { category_id: category_id } = query;",
parserOptions: { ecmaVersion: 6 },
Expand Down
46 changes: 0 additions & 46 deletions tests/lib/rules/comma-dangle.js
Expand Up @@ -90,12 +90,6 @@ ruleTester.run("comma-dangle", rule, {
{ code: "var foo = {x: {\nfoo: 'bar',\n}}", options: ["only-multiline"] },
{ code: "var foo = new Map([\n[key, {\na: 1,\nb: 2,\nc: 3,\n}],\n])", options: ["always-multiline"] },
{ code: "var foo = new Map([\n[key, {\na: 1,\nb: 2,\nc: 3,\n}],\n])", options: ["only-multiline"] },
{ code: "[,,]", options: ["always"] },
{ code: "[\n,\n,\n]", options: ["always"] },
{ code: "[,]", options: ["always"] },
{ code: "[\n,\n]", options: ["always"] },
{ code: "[]", options: ["always"] },
{ code: "[\n]", options: ["always"] },

// https://github.com/eslint/eslint/issues/3627
{
Expand Down Expand Up @@ -758,19 +752,6 @@ ruleTester.run("comma-dangle", rule, {
}
]
},
{
code: "var foo = { bar: 'baz', }",
output: "var foo = { bar: 'baz' }",
options: ["only-multiline"],
errors: [
{
message: "Unexpected trailing comma.",
type: "Property",
line: 1,
column: 23
}
]
},
{
code: "foo({\nbar: 'baz',\nqux: 'quux'\n});",
output: "foo({\nbar: 'baz',\nqux: 'quux',\n});",
Expand All @@ -797,19 +778,6 @@ ruleTester.run("comma-dangle", rule, {
}
]
},
{
code: "foo({ bar: 'baz', qux: 'quux', });",
output: "foo({ bar: 'baz', qux: 'quux' });",
options: ["only-multiline"],
errors: [
{
message: "Unexpected trailing comma.",
type: "Property",
line: 1,
column: 30
}
]
},
{
code: "var foo = [\n'baz'\n]",
output: "var foo = [\n'baz',\n]",
Expand Down Expand Up @@ -1081,27 +1049,13 @@ ruleTester.run("comma-dangle", rule, {
options: ["always-multiline"],
errors: [{ message: "Unexpected trailing comma.", type: "ImportSpecifier" }]
},
{
code: "import {foo,} from 'foo';",
output: "import {foo} from 'foo';",
parserOptions: { sourceType: "module" },
options: ["only-multiline"],
errors: [{ message: "Unexpected trailing comma.", type: "ImportSpecifier" }]
},
{
code: "export {foo,} from 'foo';",
output: "export {foo} from 'foo';",
parserOptions: { sourceType: "module" },
options: ["always-multiline"],
errors: [{ message: "Unexpected trailing comma.", type: "ExportSpecifier" }]
},
{
code: "export {foo,} from 'foo';",
output: "export {foo} from 'foo';",
parserOptions: { sourceType: "module" },
options: ["only-multiline"],
errors: [{ message: "Unexpected trailing comma.", type: "ExportSpecifier" }]
},
{
code: "import {\n foo\n} from 'foo';",
output: "import {\n foo,\n} from 'foo';",
Expand Down
19 changes: 0 additions & 19 deletions tests/lib/rules/comma-style.js
Expand Up @@ -71,10 +71,6 @@ ruleTester.run("comma-style", rule, {
code: "var ar ={fst:1,\nsnd: [1,\n2]};",
options: ["first", { exceptions: { ArrayExpression: true, ObjectExpression: true } }]
},
{
code: "var ar ={fst:1,\nsnd: [1,\n2]};",
options: ["first", { exceptions: { ArrayExpression: true, ObjectExpression: true } }]
},
{
code: "var a = 'a',\nar ={fst:1,\nsnd: [1,\n2]};",
options: ["first", {
Expand Down Expand Up @@ -122,12 +118,6 @@ ruleTester.run("comma-style", rule, {
ecmaVersion: 6
}
},
{
code: "var {foo\n, bar} = {foo:'apples', bar:'oranges'};",
parserOptions: {
ecmaVersion: 6
}
},
{
code: "var {foo\n, bar} = {foo:'apples', bar:'oranges'};",
options: ["first", {
Expand Down Expand Up @@ -481,15 +471,6 @@ ruleTester.run("comma-style", rule, {
type: "Property"
}]
},
{
code: "var foo = {'a': 1, \n 'b': 2\n ,'c': 3};",
output: "var foo = {'a': 1 \n ,'b': 2\n ,'c': 3};",
options: ["first"],
errors: [{
message: FIRST_MSG,
type: "Property"
}]
},
{
code: "var a = 'a',\no = 'o',\narr = [1,\n2];",
output: "var a = 'a',\no = 'o',\narr = [1\n,2];",
Expand Down
28 changes: 0 additions & 28 deletions tests/lib/rules/computed-property-spacing.js
Expand Up @@ -35,7 +35,6 @@ ruleTester.run("computed-property-spacing", rule, {
{ code: "obj.map(function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] },
{ code: "obj[ 'map' ](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] },
{ code: "obj[ 'for' + 'Each' ](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] },
{ code: "obj[ obj2[ foo ] ]", options: ["always"] },
{ code: "var foo = obj[ 1 ]", options: ["always"] },
{ code: "var foo = obj[ 'foo' ];", options: ["always"] },
{ code: "var foo = obj[ [1, 1] ];", options: ["always"] },
Expand All @@ -59,7 +58,6 @@ ruleTester.run("computed-property-spacing", rule, {
{ code: "obj.map(function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] },
{ code: "obj['map'](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] },
{ code: "obj['for' + 'Each'](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] },
{ code: "obj['for' + 'Each'](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] },
{ code: "obj[\nfoo]", options: ["never"] },
{ code: "obj[foo\n]", options: ["never"] },
{ code: "var foo = obj[1]", options: ["never"] },
Expand Down Expand Up @@ -128,32 +126,6 @@ ruleTester.run("computed-property-spacing", rule, {
}
]
},
{
code: "var foo = obj[ 1];",
output: "var foo = obj[ 1 ];",
options: ["always"],
errors: [
{
message: "A space is required before ']'.",
type: "MemberExpression",
column: 17,
line: 1
}
]
},
{
code: "var foo = obj[1 ];",
output: "var foo = obj[ 1 ];",
options: ["always"],
errors: [
{
message: "A space is required after '['.",
type: "MemberExpression",
column: 14,
line: 1
}
]
},
{
code: "obj[ foo ]",
output: "obj[foo]",
Expand Down
4 changes: 0 additions & 4 deletions tests/lib/rules/func-call-spacing.js
Expand Up @@ -180,10 +180,6 @@ ruleTester.run("func-call-spacing", rule, {
code: "f // comment\n ()",
options: ["always", { allowNewlines: true }]
},
{
code: "f// comment\n()",
options: ["always", { allowNewlines: true }]
},
{
code: "f\n/*\n*/\n()",
options: ["always", { allowNewlines: true }]
Expand Down
5 changes: 0 additions & 5 deletions tests/lib/rules/func-names.js
Expand Up @@ -193,11 +193,6 @@ ruleTester.run("func-names", rule, {
options: ["never"],
errors: [{ message: "Unexpected named function 'foo'.", type: "FunctionExpression" }]
},
{
code: "({foo: function foo() {}})",
options: ["never"],
errors: [{ message: "Unexpected named method 'foo'.", type: "FunctionExpression" }]
},
{
code: "({foo: function foo() {}})",
options: ["never"],
Expand Down
4 changes: 1 addition & 3 deletions tests/lib/rules/getter-return.js
Expand Up @@ -66,7 +66,6 @@ ruleTester.run("getter-return", rule, {
{ code: "var foo = { bar(){} };" },
{ code: "var foo = { bar(){ return true; } };" },
{ code: "var foo = { bar: function(){} };" },
{ code: "var foo = { bar(){ return true; } };" },
{ code: "var foo = { bar: function(){return;} };" },
{ code: "var foo = { bar: function(){return true;} };" }
],
Expand Down Expand Up @@ -103,7 +102,6 @@ ruleTester.run("getter-return", rule, {
{ code: "Object.defineProperies(foo, { bar: { get: function () {~function () { return true; }()}} });", options, errors: [{ noReturnMessage }] },

// option: {allowImplicit: true}
{ code: "Object.defineProperty(foo, \"bar\", { get: function (){}});", options, errors: [{ message: "Expected to return a value in method 'get'." }] },
{ code: "Object.defineProperies(foo, { bar: { get: function () {}} });", options, errors: [{ noReturnMessage }] }
{ code: "Object.defineProperty(foo, \"bar\", { get: function (){}});", options, errors: [{ message: "Expected to return a value in method 'get'." }] }
]
});
29 changes: 0 additions & 29 deletions tests/lib/rules/indent-legacy.js
Expand Up @@ -204,11 +204,6 @@ ruleTester.run("indent-legacy", rule, {
" );",
options: [4]
},
{
code:
"var x = 0 && { a: 1, b: 2 };",
options: [4]
},
{
code:
"require('http').request({hostname: 'localhost',\n" +
Expand Down Expand Up @@ -3557,18 +3552,6 @@ ruleTester.run("indent-legacy", rule, {
"}",
errors: expectedErrors([4, 4, 0, "Keyword"])
},
{
code:
"function foo() {\n" +
" bar();\n" +
"\t\t}",
output:
"function foo() {\n" +
" bar();\n" +
"}",
options: [2],
errors: expectedErrors([[3, "0 spaces", "2 tabs", "BlockStatement"]])
},
{
code:
"function foo() {\n" +
Expand Down Expand Up @@ -3601,18 +3584,6 @@ ruleTester.run("indent-legacy", rule, {
options: [2],
errors: expectedErrors([[4, "2 spaces", "4", "ReturnStatement"]])
},
{
code:
"function foo() {\n" +
" bar();\n" +
"\t\t}",
output:
"function foo() {\n" +
" bar();\n" +
"}",
options: [2],
errors: expectedErrors([[3, "0 spaces", "2 tabs", "BlockStatement"]])
},
{
code:
"function test(){\n" +
Expand Down
32 changes: 0 additions & 32 deletions tests/lib/rules/indent.js
Expand Up @@ -218,10 +218,6 @@ ruleTester.run("indent", rule, {
`,
options: [4]
},
{
code: "var x = 0 && { a: 1, b: 2 };",
options: [4]
},
{
code: unIndent`
require('http').request({hostname: 'localhost',
Expand Down Expand Up @@ -6574,20 +6570,6 @@ ruleTester.run("indent", rule, {
`,
errors: expectedErrors([4, 4, 0, "Keyword"])
},
{
code: unIndent`
function foo() {
bar();
\t\t}
`,
output: unIndent`
function foo() {
bar();
}
`,
options: [2],
errors: expectedErrors([[3, "0 spaces", "2 tabs", "Punctuator"]])
},
{
code: unIndent`
function foo() {
Expand Down Expand Up @@ -6624,20 +6606,6 @@ ruleTester.run("indent", rule, {
options: [2],
errors: expectedErrors([[4, 2, 4, "Punctuator"]])
},
{
code: unIndent`
function foo() {
bar();
\t\t}
`,
output: unIndent`
function foo() {
bar();
}
`,
options: [2],
errors: expectedErrors([[3, "0 spaces", "2 tabs", "Punctuator"]])
},
{
code: unIndent`
function test(){
Expand Down

0 comments on commit 0780d86

Please sign in to comment.