@samitouri / QOS-React-2 / commits / 41df3ce421

Check for warning when testing to see if error is thrown when render not defined

Battaile Fauber committed Jun 24, 2015 at 08:03 UTC 41df3ce4213e338ed75cd9d3ac0dd9f2a5725fc6
1 file changed +8
src/isomorphic/modern/class/__tests__/ReactES6Class-test.js
+8
@@ -55,8 +55,16 @@ describe('ReactES6Class', function() {
55 });
56
57 it('throws if no render function is defined', function() {
58 + spyOn(console, 'error');
59 class Foo extends React.Component { }
60 expect(() => React.render(<Foo />, container)).toThrow();
61 + expect(console.error.calls[0].args[0]).toBe(
62 + 'Warning: Foo(...): ' +
63 + 'No `render` method found on the returned component instance: you may ' +
64 + 'have forgotten to define `render` in your component or you may have ' +
65 + 'accidentally tried to render an element whose type is a function that ' +
66 + 'isn\'t a React component.'
67 + );
68 });
69
70 it('renders a simple stateless component with prop', function() {