From 19e2cf5ad557422bd04532c56e999d663fd7eb95 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Thu, 15 Oct 2015 11:51:07 -0700 Subject: [PATCH] Make ReactEmptyComponent-test not swallow logs --- .../__tests__/ReactEmptyComponent-test.js | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/src/renderers/shared/reconciler/__tests__/ReactEmptyComponent-test.js b/src/renderers/shared/reconciler/__tests__/ReactEmptyComponent-test.js index c19863f65c..cf88eaeba3 100644 --- a/src/renderers/shared/reconciler/__tests__/ReactEmptyComponent-test.js +++ b/src/renderers/shared/reconciler/__tests__/ReactEmptyComponent-test.js @@ -18,6 +18,8 @@ var TogglingComponent; var reactComponentExpect; +var log; + describe('ReactEmptyComponent', function() { beforeEach(function() { jest.resetModuleRegistry(); @@ -28,16 +30,18 @@ describe('ReactEmptyComponent', function() { reactComponentExpect = require('reactComponentExpect'); + log = jasmine.createSpy(); + TogglingComponent = React.createClass({ getInitialState: function() { return {component: this.props.firstComponent}; }, componentDidMount: function() { - console.log(ReactDOM.findDOMNode(this)); + log(ReactDOM.findDOMNode(this)); this.setState({component: this.props.secondComponent}); }, componentDidUpdate: function() { - console.log(ReactDOM.findDOMNode(this)); + log(ReactDOM.findDOMNode(this)); }, render: function() { var Component = this.state.component; @@ -81,8 +85,6 @@ describe('ReactEmptyComponent', function() { }); it('should be able to switch between rendering null and a normal tag', () => { - spyOn(console, 'log'); - var instance1 = { - spyOn(console, 'log'); - var instance1 = { - spyOn(console, 'log'); - var GrandChild = React.createClass({ render: function() { return null; @@ -169,11 +167,11 @@ describe('ReactEmptyComponent', function() { ReactTestUtils.renderIntoDocument(instance2); }).not.toThrow(); - expect(console.log.argsForCall.length).toBe(4); - expect(console.log.argsForCall[0][0].tagName).toBe('DIV'); - expect(console.log.argsForCall[1][0]).toBe(null); - expect(console.log.argsForCall[2][0]).toBe(null); - expect(console.log.argsForCall[3][0].tagName).toBe('DIV'); + expect(log.argsForCall.length).toBe(4); + expect(log.argsForCall[0][0].tagName).toBe('DIV'); + expect(log.argsForCall[1][0]).toBe(null); + expect(log.argsForCall[2][0]).toBe(null); + expect(log.argsForCall[3][0].tagName).toBe('DIV'); } );