@samitouri / QOS-React-2 / commits / d580a71293

Fix Class tests

These were introduced in #4045 as a result of jest not running properly in CI. I also fixed the places where we misspelled "misspelling".

Paul O’Shannessy committed Jun 10, 2015 at 17:06 UTC d580a71293235773d0309569482bbbf5252f1c6d
3 files changed +23 -16
src/isomorphic/modern/class/__tests__/ReactCoffeeScriptClass-test.coffee
+2 -2
@@ -301,7 +301,7 @@ describe 'ReactCoffeeScriptClass', ->
301 'contextTypes was defined as an instance property on Foo.'
302 )
303
304 - it 'should warn when mispelling shouldComponentUpdate', ->
304 + it 'should warn when misspelling shouldComponentUpdate', ->
305 spyOn console, 'error'
306 class NamedComponent
307 componentShouldUpdate: ->
@@ -319,7 +319,7 @@ describe 'ReactCoffeeScriptClass', ->
319 question because the function is expected to return a value.'
320 )
321
322 - it 'should warn when mispelling componentWillReceiveProps', ->
322 + it 'should warn when misspelling componentWillReceiveProps', ->
323 spyOn console, 'error'
324 class NamedComponent
325 componentWillRecieveProps: ->
src/isomorphic/modern/class/__tests__/ReactES6Class-test.js
+4 -4
@@ -341,7 +341,7 @@ describe('ReactES6Class', function() {
341 );
342 });
343
344 - it('should warn when mispelling shouldComponentUpdate', function() {
344 + it('should warn when misspelling shouldComponentUpdate', function() {
345 spyOn(console, 'error');
346
347 class NamedComponent {
@@ -363,7 +363,7 @@ describe('ReactES6Class', function() {
363 );
364 });
365
366 - it('should warn when mispelling componentWillReceiveProps', function() {
366 + it('should warn when misspelling componentWillReceiveProps', function() {
367 spyOn(console, 'error');
368
369 class NamedComponent {
@@ -379,8 +379,8 @@ describe('ReactES6Class', function() {
379 expect(console.error.calls.length).toBe(1);
380 expect(console.error.calls[0].args[0]).toBe(
381 'Warning: ' +
382 - 'NamedComponent has a method called componentWillRecieveProps(). Did you ' +
383 - 'mean componentWillReceiveProps()?'
382 + 'NamedComponent has a method called componentWillRecieveProps(). Did ' +
383 + 'you mean componentWillReceiveProps()?'
384 );
385 });
386
src/isomorphic/modern/class/__tests__/ReactTypeScriptClass-test.ts
+17 -10
@@ -252,11 +252,18 @@ class ClassicProperties extends React.Component {
252 }
253 }
254
255 -// it should warn when mispelling shouldComponentUpdate
256 -class NamedComponent {
255 +// it should warn when misspelling shouldComponentUpdate
256 +class MisspelledComponent1 {
257 componentShouldUpdate() {
258 return false;
259 }
260 + render() {
261 + return React.createElement('span', {className: 'foo'});
262 + }
263 +}
264 +
265 +// it should warn when misspelling componentWillReceiveProps
266 +class MisspelledComponent2 {
267 componentWillRecieveProps() {
268 return false;
269 }
@@ -439,32 +446,32 @@ describe('ReactTypeScriptClass', function() {
446 );
447 });
448
442 - it('should warn when mispelling shouldComponentUpdate', function() {
449 + it('should warn when misspelling shouldComponentUpdate', function() {
450 var warn = jest.genMockFn();
451 console.error = warn;
452
446 - test(React.createElement(NamedComponent), 'SPAN', 'foo');
453 + test(React.createElement(MisspelledComponent1), 'SPAN', 'foo');
454
455 expect(warn.mock.calls.length).toBe(1);
456 expect(warn.mock.calls[0][0]).toBe(
457 'Warning: ' +
451 - 'NamedComponent has a method called componentShouldUpdate(). Did you ' +
452 - 'mean shouldComponentUpdate()? The name is phrased as a question ' +
458 + 'MisspelledComponent1 has a method called componentShouldUpdate(). Did ' +
459 + 'you mean shouldComponentUpdate()? The name is phrased as a question ' +
460 'because the function is expected to return a value.'
461 );
462 });
463
457 - it('should warn when mispelling componentWillReceiveProps', function() {
464 + it('should warn when misspelling componentWillReceiveProps', function() {
465 var warn = jest.genMockFn();
466 console.error = warn;
467
461 - test(React.createElement(NamedComponent), 'SPAN', 'foo');
468 + test(React.createElement(MisspelledComponent2), 'SPAN', 'foo');
469
470 expect(warn.mock.calls.length).toBe(1);
471 expect(warn.mock.calls[0][0]).toBe(
472 'Warning: ' +
466 - 'NamedComponent has a method called componentWillRecieveProps(). Did you ' +
467 - 'mean componentWillReceiveProps()?'
473 + 'MisspelledComponent2 has a method called componentWillRecieveProps(). ' +
474 + 'Did you mean componentWillReceiveProps()?'
475 );
476 });
477