Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit 34accdc

Browse files
committed
Use sandbox for spying on methods so that they can be reused
1 parent dee0579 commit 34accdc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/component.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { expect } from 'chai';
33
import { shallow, mount, render } from 'enzyme';
44
import Pic from '../lib/';
5-
import sinon, { spy } from 'sinon';
5+
import sinon from 'sinon';
66

77
describe('Pic', function() {
88
let sandbox;
@@ -114,7 +114,7 @@ describe('Pic', function() {
114114
]
115115
};
116116

117-
spy(Pic.prototype, 'inViewHandler');
117+
sandbox.spy(Pic.prototype, 'inViewHandler');
118118
mount(<Pic { ...props } />);
119119

120120
expect(Pic.prototype.inViewHandler.callCount).to.equal(1);
@@ -134,7 +134,7 @@ describe('Pic', function() {
134134
]
135135
};
136136

137-
spy(Pic.prototype, 'componentWillUnmount');
137+
sandbox.spy(Pic.prototype, 'componentWillUnmount');
138138
const wrapper = mount(<Pic { ...props } />);
139139
wrapper.unmount();
140140
expect(Pic.prototype.componentWillUnmount.callCount).to.equal(1);
@@ -155,7 +155,7 @@ describe('Pic', function() {
155155
]
156156
};
157157

158-
spy(Pic.prototype, 'setResponsiveImage');
158+
sandbox.spy(Pic.prototype, 'setResponsiveImage');
159159
mount(<Pic { ...props } />);
160160

161161
expect(Pic.prototype.setResponsiveImage.callCount).to.equal(1);

0 commit comments

Comments
 (0)