Skip to content

Commit 75711e5

Browse files
author
Haridu Senadeera
committed
updated tests
1 parent 2ee095e commit 75711e5

File tree

1 file changed

+109
-20
lines changed

1 file changed

+109
-20
lines changed

tests/lib/rules/no-typos.js

Lines changed: 109 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,13 @@ ruleTester.run('no-typos', rule, {
185185
}, {
186186
code: [
187187
'class Hello extends React.Component {',
188+
' componentWillMount() { }',
189+
' componentDidMount() { }',
190+
' componentWillReceiveProps() { }',
191+
' shouldComponentUpdate() { }',
192+
' componentWillUpdate() { }',
188193
' componentDidUpdate() { }',
194+
' componentWillUnmount() { }',
189195
' render() {',
190196
' return <div>Hello {this.props.name}</div>;',
191197
' }',
@@ -194,34 +200,43 @@ ruleTester.run('no-typos', rule, {
194200
parserOptions: parserOptions
195201
}, {
196202
code: [
197-
'class Hello extends React.Component {',
203+
'class MyClass {',
198204
' componentWillMount() { }',
205+
' componentDidMount() { }',
206+
' componentWillReceiveProps() { }',
207+
' shouldComponentUpdate() { }',
208+
' componentWillUpdate() { }',
199209
' componentDidUpdate() { }',
200-
' render() {',
201-
' return <div>Hello {this.props.name}</div>;',
202-
' }',
210+
' componentWillUnmount() { }',
211+
' render() { }',
203212
'}'
204213
].join('\n'),
205214
parserOptions: parserOptions
206215
}, {
207216
code: [
208-
'class Hello extends React.Component {',
209-
' componentWillUnmount() { }',
210-
' componentWillMount() { }',
211-
' render() {',
212-
' return <div>Hello {this.props.name}</div>;',
213-
' }',
217+
'class MyClass {',
218+
' componentwillmount() { }',
219+
' componentdidmount() { }',
220+
' componentwillreceiveprops() { }',
221+
' shouldcomponentupdate() { }',
222+
' componentwillupdate() { }',
223+
' componentdidupdate() { }',
224+
' componentwillUnmount() { }',
225+
' render() { }',
214226
'}'
215227
].join('\n'),
216228
parserOptions: parserOptions
217229
}, {
218230
code: [
219-
'class Hello extends React.Component {',
220-
' shouldComponentUpdate() { }',
221-
' componentWillReceiveProps() { }',
222-
' render() {',
223-
' return <div>Hello {this.props.name}</div>;',
224-
' }',
231+
'class MyClass {',
232+
' Componentwillmount() { }',
233+
' Componentdidmount() { }',
234+
' Componentwillreceiveprops() { }',
235+
' Shouldcomponentupdate() { }',
236+
' Componentwillupdate() { }',
237+
' Componentdidupdate() { }',
238+
' ComponentwillUnmount() { }',
239+
' Render() { }',
225240
'}'
226241
].join('\n'),
227242
parserOptions: parserOptions
@@ -414,7 +429,13 @@ ruleTester.run('no-typos', rule, {
414429
}, {
415430
code: [
416431
'class Hello extends React.Component {',
432+
' ComponentWillMount() { }',
433+
' ComponentDidMount() { }',
434+
' ComponentWillReceiveProps() { }',
435+
' ShouldComponentUpdate() { }',
436+
' ComponentWillUpdate() { }',
417437
' ComponentDidUpdate() { }',
438+
' ComponentWillUnmount() { }',
418439
' render() {',
419440
' return <div>Hello {this.props.name}</div>;',
420441
' }',
@@ -424,12 +445,36 @@ ruleTester.run('no-typos', rule, {
424445
errors: [{
425446
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
426447
type: 'MethodDefinition'
448+
}, {
449+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
450+
type: 'MethodDefinition'
451+
}, {
452+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
453+
type: 'MethodDefinition'
454+
}, {
455+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
456+
type: 'MethodDefinition'
457+
}, {
458+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
459+
type: 'MethodDefinition'
460+
}, {
461+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
462+
type: 'MethodDefinition'
463+
}, {
464+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
465+
type: 'MethodDefinition'
427466
}]
428467
}, {
429468
code: [
430469
'class Hello extends React.Component {',
431-
' componentwillreceiveprops() { }',
432-
' render() {',
470+
' Componentwillmount() { }',
471+
' Componentdidmount() { }',
472+
' Componentwillreceiveprops() { }',
473+
' Shouldcomponentupdate() { }',
474+
' Componentwillupdate() { }',
475+
' Componentdidupdate() { }',
476+
' Componentwillunmount() { }',
477+
' Render() {',
433478
' return <div>Hello {this.props.name}</div>;',
434479
' }',
435480
'}'
@@ -438,12 +483,38 @@ ruleTester.run('no-typos', rule, {
438483
errors: [{
439484
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
440485
type: 'MethodDefinition'
486+
}, {
487+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
488+
type: 'MethodDefinition'
489+
}, {
490+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
491+
type: 'MethodDefinition'
492+
}, {
493+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
494+
type: 'MethodDefinition'
495+
}, {
496+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
497+
type: 'MethodDefinition'
498+
}, {
499+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
500+
type: 'MethodDefinition'
501+
}, {
502+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
503+
type: 'MethodDefinition'
504+
}, {
505+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
506+
type: 'MethodDefinition'
441507
}]
442508
}, {
443509
code: [
444510
'class Hello extends React.Component {',
445-
' componentWillReceiveProps() { }',
446-
' componentWillupdate() { }',
511+
' componentwillmount() { }',
512+
' componentdidmount() { }',
513+
' componentwillreceiveprops() { }',
514+
' shouldcomponentupdate() { }',
515+
' componentwillupdate() { }',
516+
' componentdidupdate() { }',
517+
' componentwillunmount() { }',
447518
' render() {',
448519
' return <div>Hello {this.props.name}</div>;',
449520
' }',
@@ -453,6 +524,24 @@ ruleTester.run('no-typos', rule, {
453524
errors: [{
454525
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
455526
type: 'MethodDefinition'
527+
}, {
528+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
529+
type: 'MethodDefinition'
530+
}, {
531+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
532+
type: 'MethodDefinition'
533+
}, {
534+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
535+
type: 'MethodDefinition'
536+
}, {
537+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
538+
type: 'MethodDefinition'
539+
}, {
540+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
541+
type: 'MethodDefinition'
542+
}, {
543+
message: ERROR_MESSAGE_LIFECYCLE_METHOD,
544+
type: 'MethodDefinition'
456545
}]
457546
}]
458547
});

0 commit comments

Comments
 (0)