diff --git a/test/Player.js b/test/Player.js index 4812bbce..fe6e9992 100644 --- a/test/Player.js +++ b/test/Player.js @@ -7,10 +7,6 @@ import Player from '../src/Player' configure({ adapter: new Adapter() }) -Player.prototype.componentWillMount = function () { - this.handlePlayerMount({ load: () => null }) -} - test('componentWillUnmount()', t => { const wrapper = shallow() const fake = sinon.fake() @@ -53,6 +49,7 @@ test('set loadOnReady', t => { const stub = sinon.stub(console, 'warn') const wrapper = shallow( null} />) const instance = wrapper.instance() + instance.handlePlayerMount({ load: () => {} }) instance.isLoading = true wrapper.setProps({ url: 'another-file.mp4' }) t.true(stub.calledOnce) @@ -238,6 +235,7 @@ test('loadOnReady', t => { test('onPlay()', t => { const onPlay = sinon.fake() const instance = shallow().instance() + instance.handlePlayerMount({ load: () => {} }) instance.handleDurationCheck = sinon.fake() instance.handlePlay() t.true(onPlay.calledOnce) @@ -248,6 +246,7 @@ test('onPlay()', t => { test('onStart()', t => { const onStart = sinon.fake() const instance = shallow().instance() + instance.handlePlayerMount({ load: () => {} }) instance.handleDurationCheck = sinon.fake() instance.startOnPlay = true instance.handlePlay() @@ -258,6 +257,7 @@ test('onStart()', t => { test('seekOnPlay', t => { const seekTo = sinon.stub(Player.prototype, 'seekTo') const instance = shallow().instance() + instance.handlePlayerMount({ load: () => {} }) instance.handleDurationCheck = sinon.fake() instance.seekOnPlay = 10 instance.handlePlay() @@ -298,6 +298,7 @@ test('loopOnEnded', t => { activePlayer.loopOnEnded = true const seekTo = sinon.stub(Player.prototype, 'seekTo') const instance = shallow().instance() + instance.handlePlayerMount({ load: () => {} }) instance.isPlaying = true instance.handleEnded() t.true(seekTo.calledOnceWith(0))