From dd0b1a643b8238c9b38db9d472cfc2c78b9a74b9 Mon Sep 17 00:00:00 2001 From: Matias Singers Date: Sun, 11 Oct 2015 15:42:24 +0800 Subject: [PATCH] Consistently use `calls.length` instead of `callCount` for Jasmine spies, take II See #3105 for take I --- src/renderers/dom/client/__tests__/ReactMount-test.js | 2 +- .../dom/client/__tests__/ReactMountDestruction-test.js | 4 ++-- .../reconciler/__tests__/ReactCompositeComponent-test.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/renderers/dom/client/__tests__/ReactMount-test.js b/src/renderers/dom/client/__tests__/ReactMount-test.js index 632f04bf6b..4291e60ce5 100644 --- a/src/renderers/dom/client/__tests__/ReactMount-test.js +++ b/src/renderers/dom/client/__tests__/ReactMount-test.js @@ -237,7 +237,7 @@ describe('ReactMount', function() { spyOn(console, 'error'); var rootNode = container.firstChild; ReactDOM.render(, rootNode); - expect(console.error.callCount).toBe(1); + expect(console.error.calls.length).toBe(1); expect(console.error.mostRecentCall.args[0]).toBe( 'Warning: render(...): Replacing React-rendered children with a new ' + 'root component. If you intended to update the children of this node, ' + diff --git a/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js b/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js index cafc10d340..be92a11747 100644 --- a/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js +++ b/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js @@ -53,7 +53,7 @@ describe('ReactMount', function() { var rootDiv = mainContainerDiv.firstChild; spyOn(console, 'error'); ReactDOM.unmountComponentAtNode(rootDiv); - expect(console.error.callCount).toBe(1); + expect(console.error.calls.length).toBe(1); expect(console.error.mostRecentCall.args[0]).toBe( 'Warning: unmountComponentAtNode(): The node you\'re attempting to ' + 'unmount was rendered by React and is not a top-level container. You ' + @@ -77,7 +77,7 @@ describe('ReactMount', function() { var nonRootDiv = mainContainerDiv.firstChild.firstChild; spyOn(console, 'error'); ReactDOM.unmountComponentAtNode(nonRootDiv); - expect(console.error.callCount).toBe(1); + expect(console.error.calls.length).toBe(1); expect(console.error.mostRecentCall.args[0]).toBe( 'Warning: unmountComponentAtNode(): The node you\'re attempting to ' + 'unmount was rendered by React and is not a top-level container. ' + diff --git a/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js b/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js index 1e6ec8f020..4b19aa5e1f 100644 --- a/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js +++ b/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js @@ -522,7 +522,7 @@ describe('ReactCompositeComponent', function() { // unmountIDFromEnvironment which calls purgeID, for a total of 3. // TODO: Test the effect of this. E.g. does the node cache get repopulated // after a getDOMNode call? - expect(ReactMount.purgeID.callCount).toBe(3); + expect(ReactMount.purgeID.calls.length).toBe(3); }); it('should warn when shouldComponentUpdate() returns undefined', function() {