Consistently use `calls.length` instead of `callCount` for Jasmine spies, take II
See #3105 for take I
Matias Singers committed
Oct 11, 2015 at 15:42 UTC
dd0b1a643b8238c9b38db9d472cfc2c78b9a74b9
3 files changed
+4
-4
src/renderers/dom/client/__tests__/ReactMount-test.js
+1
-1
@@ -237,7 +237,7 @@ describe('ReactMount', function() {
237
spyOn(console, 'error');
238
var rootNode = container.firstChild;
239
ReactDOM.render(<span />, rootNode);
240
- expect(console.error.callCount).toBe(1);
240
+ expect(console.error.calls.length).toBe(1);
241
expect(console.error.mostRecentCall.args[0]).toBe(
242
'Warning: render(...): Replacing React-rendered children with a new ' +
243
'root component. If you intended to update the children of this node, ' +
src/renderers/dom/client/__tests__/ReactMountDestruction-test.js
+2
-2
@@ -53,7 +53,7 @@ describe('ReactMount', function() {
53
var rootDiv = mainContainerDiv.firstChild;
54
spyOn(console, 'error');
55
ReactDOM.unmountComponentAtNode(rootDiv);
56
- expect(console.error.callCount).toBe(1);
56
+ expect(console.error.calls.length).toBe(1);
57
expect(console.error.mostRecentCall.args[0]).toBe(
58
'Warning: unmountComponentAtNode(): The node you\'re attempting to ' +
59
'unmount was rendered by React and is not a top-level container. You ' +
@@ -77,7 +77,7 @@ describe('ReactMount', function() {
77
var nonRootDiv = mainContainerDiv.firstChild.firstChild;
78
spyOn(console, 'error');
79
ReactDOM.unmountComponentAtNode(nonRootDiv);
80
- expect(console.error.callCount).toBe(1);
80
+ expect(console.error.calls.length).toBe(1);
81
expect(console.error.mostRecentCall.args[0]).toBe(
82
'Warning: unmountComponentAtNode(): The node you\'re attempting to ' +
83
'unmount was rendered by React and is not a top-level container. ' +
src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js
+1
-1
@@ -522,7 +522,7 @@ describe('ReactCompositeComponent', function() {
522
// unmountIDFromEnvironment which calls purgeID, for a total of 3.
523
// TODO: Test the effect of this. E.g. does the node cache get repopulated
524
// after a getDOMNode call?
525
- expect(ReactMount.purgeID.callCount).toBe(3);
525
+ expect(ReactMount.purgeID.calls.length).toBe(3);
526
});
527
528
it('should warn when shouldComponentUpdate() returns undefined', function() {