Skip to content

Commit c9b60a6

Browse files
mdjermanovicljharb
authored andcommitted
[Tests] remove duplicate tests
1 parent a762b25 commit c9b60a6

13 files changed

+1
-180
lines changed

tests/lib/rules/destructuring-assignment.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -374,18 +374,6 @@ ruleTester.run('destructuring-assignment', rule, {
374374
code: `
375375
import { useContext } from 'react';
376376
377-
const MyComponent = (props) => {
378-
const {foo} = useContext(aContext);
379-
return <div>{foo}</div>
380-
};
381-
`,
382-
options: ['always'],
383-
settings: { react: { version: '16.9.0' } },
384-
},
385-
{
386-
code: `
387-
import { useContext } from 'react';
388-
389377
const MyComponent = (props) => {
390378
const foo = useContext(aContext);
391379
return <div>{foo.test}</div>

tests/lib/rules/display-name.js

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -369,39 +369,6 @@ ruleTester.run('display-name', rule, {
369369
};
370370
`,
371371
},
372-
{
373-
code: `
374-
import React, {createElement} from "react";
375-
const SomeComponent = (props) => {
376-
const {foo, bar} = props;
377-
return someComponentFactory({
378-
onClick: () => foo(bar("x"))
379-
});
380-
};
381-
`,
382-
},
383-
{
384-
code: `
385-
import React, {Component} from "react";
386-
function someDecorator(ComposedComponent) {
387-
return class MyDecorator extends Component {
388-
render() {return <ComposedComponent {...this.props} />;}
389-
};
390-
}
391-
module.exports = someDecorator;
392-
`,
393-
},
394-
{
395-
code: `
396-
import React, {Component} from "react";
397-
function someDecorator(ComposedComponent) {
398-
return class MyDecorator extends Component {
399-
render() {return <ComposedComponent {...this.props} />;}
400-
};
401-
}
402-
module.exports = someDecorator;
403-
`,
404-
},
405372
{
406373
code: `
407374
const element = (

tests/lib/rules/forbid-component-props.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -166,21 +166,6 @@ ruleTester.run('forbid-component-props', rule, {
166166
},
167167
],
168168
},
169-
{
170-
code: `
171-
const item = (<Foo className="foo" />);
172-
`,
173-
options: [
174-
{
175-
forbid: [
176-
{
177-
propName: 'className',
178-
disallowedFor: ['ReactModal'],
179-
},
180-
],
181-
},
182-
],
183-
},
184169
{
185170
code: `
186171
<fbt:param name="Total number of files" number={true} />

tests/lib/rules/jsx-curly-brace-presence.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -657,12 +657,6 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
657657
options: [{ props: 'always' }],
658658
errors: [{ messageId: 'missingCurly' }],
659659
},
660-
{
661-
code: `<MyComponent prop="foo 'bar'">foo</MyComponent>`,
662-
output: `<MyComponent prop={"foo 'bar'"}>foo</MyComponent>`,
663-
options: [{ props: 'always' }],
664-
errors: [{ messageId: 'missingCurly' }],
665-
},
666660
{
667661
code: '<MyComponent>foo bar </MyComponent>',
668662
output: `<MyComponent>{"foo bar "}</MyComponent>`,

tests/lib/rules/jsx-curly-spacing.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -756,14 +756,6 @@ ruleTester.run('jsx-curly-spacing', rule, {
756756
`,
757757
options: ['always'],
758758
},
759-
{
760-
code: `
761-
<App {
762-
...bar
763-
} />;
764-
`,
765-
options: ['always'],
766-
},
767759
{
768760
code: `
769761
<App {

tests/lib/rules/jsx-handler-names.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ ruleTester.run('jsx-handler-names', rule, {
265265
],
266266
},
267267
{
268-
code: '<TestComponent only={this.handleChange} />',
268+
code: '<TestComponent2 only={this.handleChange} />',
269269
errors: [
270270
{
271271
messageId: 'badPropKey',

tests/lib/rules/jsx-no-leaked-render.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,6 @@ ruleTester.run('jsx-no-leaked-render', rule, {
126126
`,
127127
options: [{ validStrategies: ['coerce', 'ternary'] }],
128128
},
129-
{
130-
code: `
131-
const Component = ({ elements, count }) => {
132-
return <div>{!!count && <List elements={elements}/>}</div>
133-
}
134-
`,
135-
options: [{ validStrategies: ['coerce'] }],
136-
},
137129

138130
// Fixes for:
139131
// - https://github.com/jsx-eslint/eslint-plugin-react/issues/3292

tests/lib/rules/jsx-one-expression-per-line.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -937,26 +937,6 @@ foo
937937
<App>
938938
<Foo></
939939
Foo>
940-
</App>
941-
`,
942-
errors: [
943-
{
944-
messageId: 'moveToNewLine',
945-
data: { descriptor: 'Foo' },
946-
},
947-
],
948-
parserOptions,
949-
},
950-
{
951-
code: `
952-
<App>
953-
<Foo></
954-
Foo></App>
955-
`,
956-
output: `
957-
<App>
958-
<Foo></
959-
Foo>
960940
</App>
961941
`,
962942
errors: [

tests/lib/rules/jsx-wrap-multilines.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,16 +1393,6 @@ ruleTester.run('jsx-wrap-multilines', rule, {
13931393
{ messageId: 'parensOnNewLines' },
13941394
],
13951395
},
1396-
{
1397-
code: DECLARATION_TERNARY_PAREN_FRAGMENT,
1398-
features: ['fragment'],
1399-
output: addNewLineSymbols(DECLARATION_TERNARY_PAREN_FRAGMENT),
1400-
options: [{ declaration: 'parens-new-line' }],
1401-
errors: [
1402-
{ messageId: 'parensOnNewLines' },
1403-
{ messageId: 'parensOnNewLines' },
1404-
],
1405-
},
14061396
{
14071397
code: ASSIGNMENT_TERNARY_NO_PAREN,
14081398
output: addNewLineSymbols(ASSIGNMENT_TERNARY_PAREN),

tests/lib/rules/no-redundant-should-component-update.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,6 @@ ruleTester.run('no-redundant-should-component-update', rule, {
3737
`,
3838
parserOptions,
3939
},
40-
{
41-
code: `
42-
class Foo extends React.Component {
43-
shouldComponentUpdate() {
44-
return true;
45-
}
46-
}
47-
`,
48-
parserOptions,
49-
},
5040
{
5141
code: `
5242
class Foo extends React.Component {

tests/lib/rules/prop-types.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,15 +1588,6 @@ ruleTester.run('prop-types', rule, {
15881588
}
15891589
`,
15901590
},
1591-
{
1592-
// Async generator functions can't be components.
1593-
code: `
1594-
var Hello = async function* (props) {
1595-
yield null;
1596-
return <div>Hello {props.name}</div>;
1597-
}
1598-
`,
1599-
},
16001591
{
16011592
// Flow annotations with variance
16021593
code: `
@@ -5320,27 +5311,6 @@ ruleTester.run('prop-types', rule, {
53205311
},
53215312
],
53225313
},
5323-
{
5324-
code: `
5325-
class Test extends Foo.Component {
5326-
render() {
5327-
return (
5328-
<div>{this.props.firstname} {this.props.lastname}</div>
5329-
);
5330-
}
5331-
}
5332-
Test.propTypes = {
5333-
firstname: PropTypes.string
5334-
};
5335-
`,
5336-
settings,
5337-
errors: [
5338-
{
5339-
messageId: 'missingPropType',
5340-
data: { name: 'lastname' },
5341-
},
5342-
],
5343-
},
53445314
{
53455315
code: `
53465316
class Test extends Foo.Component {

tests/lib/rules/react-in-jsx-scope.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ ruleTester.run('react-in-jsx-scope', rule, {
4444
{ code: 'var React; <x-gif />;' },
4545
{ code: 'var React, App, a=1; <App attr={a} />;' },
4646
{ code: 'var React, App, a=1; function elem() { return <App attr={a} />; }' },
47-
{
48-
code: 'var React, App; <App />;',
49-
},
5047
{ code: '/** @jsx Foo */ var Foo, App; <App />;' },
5148
{ code: '/** @jsx Foo.Bar */ var Foo, App; <App />;' },
5249
{

tests/lib/rules/require-default-props.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3019,30 +3019,6 @@ ruleTester.run('require-default-props', rule, {
30193019
},
30203020
],
30213021
},
3022-
{
3023-
code: `
3024-
function MyStatelessComponent({ foo, bar }) {
3025-
return <div>{foo}{bar}</div>;
3026-
}
3027-
MyStatelessComponent.propTypes = {
3028-
foo: PropTypes.string,
3029-
bar: PropTypes.string.isRequired
3030-
};
3031-
MyStatelessComponent.propTypes.baz = React.propTypes.string;
3032-
`,
3033-
errors: [
3034-
{
3035-
messageId: 'shouldHaveDefault',
3036-
data: { name: 'foo' },
3037-
line: 6,
3038-
},
3039-
{
3040-
messageId: 'shouldHaveDefault',
3041-
data: { name: 'baz' },
3042-
line: 9,
3043-
},
3044-
],
3045-
},
30463022

30473023
{
30483024
code: `

0 commit comments

Comments
 (0)