Skip to content

Commit 50b39ea

Browse files
committed
Make soundLibrary.playSound a stub instead of a spy
1 parent 1b01a50 commit 50b39ea

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

test/unit/oceans/ui.test.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ const DEFAULT_PROPS = {
1717
};
1818

1919
describe('Button', () => {
20-
let onClickMock, playSoundSpy;
20+
let onClickMock, playSoundStub;
2121

2222
beforeEach(() => {
23-
soundLibrary.injectSoundAPIs({playSound: sinon.fake()});
24-
playSoundSpy = sinon.spy(soundLibrary, 'playSound');
23+
playSoundStub = sinon.stub(soundLibrary, 'playSound');
2524
onClickMock = sinon.fake.returns(false);
2625
});
2726

@@ -56,7 +55,7 @@ describe('Button', () => {
5655
);
5756

5857
wrapper.simulate('click');
59-
expect(playSoundSpy.callCount).toEqual(0);
58+
expect(playSoundStub.callCount).toEqual(0);
6059
});
6160

6261
describe('onClick prop does not return false', () => {
@@ -67,7 +66,7 @@ describe('Button', () => {
6766
);
6867

6968
wrapper.simulate('click');
70-
expect(playSoundSpy.withArgs('sortyes').calledOnce).toBeTruthy();
69+
expect(playSoundStub.withArgs('sortyes').calledOnce).toBeTruthy();
7170
});
7271

7372
it('plays "other" sound if sound not supplied', () => {
@@ -77,7 +76,7 @@ describe('Button', () => {
7776
);
7877

7978
wrapper.simulate('click');
80-
expect(playSoundSpy.withArgs('other').calledOnce).toBeTruthy();
79+
expect(playSoundStub.withArgs('other').calledOnce).toBeTruthy();
8180
});
8281
});
8382
});

0 commit comments

Comments
 (0)