Skip to content

Commit 30314c7

Browse files
committed
Fix Player tests
1 parent d053d4a commit 30314c7

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

test/Player.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ import Player from '../src/Player'
77

88
configure({ adapter: new Adapter() })
99

10-
Player.prototype.componentWillMount = function () {
11-
this.handlePlayerMount({ load: () => null })
12-
}
13-
1410
test('componentWillUnmount()', t => {
1511
const wrapper = shallow(<Player />)
1612
const fake = sinon.fake()
@@ -53,6 +49,7 @@ test('set loadOnReady', t => {
5349
const stub = sinon.stub(console, 'warn')
5450
const wrapper = shallow(<Player url='file.mp4' activePlayer={() => null} />)
5551
const instance = wrapper.instance()
52+
instance.handlePlayerMount({ load: () => {} })
5653
instance.isLoading = true
5754
wrapper.setProps({ url: 'another-file.mp4' })
5855
t.true(stub.calledOnce)
@@ -238,6 +235,7 @@ test('loadOnReady', t => {
238235
test('onPlay()', t => {
239236
const onPlay = sinon.fake()
240237
const instance = shallow(<Player onPlay={onPlay} />).instance()
238+
instance.handlePlayerMount({ load: () => {} })
241239
instance.handleDurationCheck = sinon.fake()
242240
instance.handlePlay()
243241
t.true(onPlay.calledOnce)
@@ -248,6 +246,7 @@ test('onPlay()', t => {
248246
test('onStart()', t => {
249247
const onStart = sinon.fake()
250248
const instance = shallow(<Player onStart={onStart} />).instance()
249+
instance.handlePlayerMount({ load: () => {} })
251250
instance.handleDurationCheck = sinon.fake()
252251
instance.startOnPlay = true
253252
instance.handlePlay()
@@ -258,6 +257,7 @@ test('onStart()', t => {
258257
test('seekOnPlay', t => {
259258
const seekTo = sinon.stub(Player.prototype, 'seekTo')
260259
const instance = shallow(<Player />).instance()
260+
instance.handlePlayerMount({ load: () => {} })
261261
instance.handleDurationCheck = sinon.fake()
262262
instance.seekOnPlay = 10
263263
instance.handlePlay()
@@ -298,6 +298,7 @@ test('loopOnEnded', t => {
298298
activePlayer.loopOnEnded = true
299299
const seekTo = sinon.stub(Player.prototype, 'seekTo')
300300
const instance = shallow(<Player loop activePlayer={activePlayer} />).instance()
301+
instance.handlePlayerMount({ load: () => {} })
301302
instance.isPlaying = true
302303
instance.handleEnded()
303304
t.true(seekTo.calledOnceWith(0))

0 commit comments

Comments
 (0)