Skip to content

Commit

Permalink
Fix Player tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cookpete committed May 7, 2022
1 parent d053d4a commit 30314c7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(<Player />)
const fake = sinon.fake()
Expand Down Expand Up @@ -53,6 +49,7 @@ test('set loadOnReady', t => {
const stub = sinon.stub(console, 'warn')
const wrapper = shallow(<Player url='file.mp4' activePlayer={() => null} />)
const instance = wrapper.instance()
instance.handlePlayerMount({ load: () => {} })
instance.isLoading = true
wrapper.setProps({ url: 'another-file.mp4' })
t.true(stub.calledOnce)
Expand Down Expand Up @@ -238,6 +235,7 @@ test('loadOnReady', t => {
test('onPlay()', t => {
const onPlay = sinon.fake()
const instance = shallow(<Player onPlay={onPlay} />).instance()
instance.handlePlayerMount({ load: () => {} })
instance.handleDurationCheck = sinon.fake()
instance.handlePlay()
t.true(onPlay.calledOnce)
Expand All @@ -248,6 +246,7 @@ test('onPlay()', t => {
test('onStart()', t => {
const onStart = sinon.fake()
const instance = shallow(<Player onStart={onStart} />).instance()
instance.handlePlayerMount({ load: () => {} })
instance.handleDurationCheck = sinon.fake()
instance.startOnPlay = true
instance.handlePlay()
Expand All @@ -258,6 +257,7 @@ test('onStart()', t => {
test('seekOnPlay', t => {
const seekTo = sinon.stub(Player.prototype, 'seekTo')
const instance = shallow(<Player />).instance()
instance.handlePlayerMount({ load: () => {} })
instance.handleDurationCheck = sinon.fake()
instance.seekOnPlay = 10
instance.handlePlay()
Expand Down Expand Up @@ -298,6 +298,7 @@ test('loopOnEnded', t => {
activePlayer.loopOnEnded = true
const seekTo = sinon.stub(Player.prototype, 'seekTo')
const instance = shallow(<Player loop activePlayer={activePlayer} />).instance()
instance.handlePlayerMount({ load: () => {} })
instance.isPlaying = true
instance.handleEnded()
t.true(seekTo.calledOnceWith(0))
Expand Down

0 comments on commit 30314c7

Please sign in to comment.