Disable radio populate after too much consecutive errors
This commit is contained in:
parent
dac8d6e05e
commit
7dfafea26c
5 changed files with 45 additions and 4 deletions
|
|
@ -74,6 +74,16 @@ describe('store/player', () => {
|
|||
store.mutations.toggleLooping(state)
|
||||
expect(state.looping).to.equal(0)
|
||||
})
|
||||
it('increment error count', () => {
|
||||
const state = { errorCount: 0 }
|
||||
store.mutations.incrementErrorCount(state)
|
||||
expect(state.errorCount).to.equal(1)
|
||||
})
|
||||
it('reset error count', () => {
|
||||
const state = { errorCount: 10 }
|
||||
store.mutations.resetErrorCount(state)
|
||||
expect(state.errorCount).to.equal(0)
|
||||
})
|
||||
})
|
||||
describe('getters', () => {
|
||||
it('durationFormatted', () => {
|
||||
|
|
@ -145,8 +155,10 @@ describe('store/player', () => {
|
|||
testAction({
|
||||
action: store.actions.trackErrored,
|
||||
payload: {test: 'track'},
|
||||
params: {state: {errorCount: 0, maxConsecutiveErrors: 5}},
|
||||
expectedMutations: [
|
||||
{ type: 'errored', payload: true }
|
||||
{ type: 'errored', payload: true },
|
||||
{ type: 'incrementErrorCount' }
|
||||
],
|
||||
expectedActions: [
|
||||
{ type: 'queue/next', payload: null, options: {root: true} }
|
||||
|
|
|
|||
|
|
@ -69,7 +69,11 @@ describe('store/radios', () => {
|
|||
})
|
||||
testAction({
|
||||
action: store.actions.populateQueue,
|
||||
params: {state: {running: true, current: {session: 1}}},
|
||||
params: {
|
||||
state: {running: true, current: {session: 1}},
|
||||
rootState: {player: {errorCount: 0, maxConsecutiveErrors: 5}}
|
||||
|
||||
},
|
||||
expectedActions: [
|
||||
{ type: 'queue/append', payload: {track: {id: 1}}, options: {root: true} }
|
||||
]
|
||||
|
|
@ -82,5 +86,17 @@ describe('store/radios', () => {
|
|||
expectedActions: []
|
||||
}, done)
|
||||
})
|
||||
it('populateQueue does nothing when too much errors', (done) => {
|
||||
testAction({
|
||||
action: store.actions.populateQueue,
|
||||
payload: {test: 'track'},
|
||||
params: {
|
||||
rootState: {player: {errorCount: 5, maxConsecutiveErrors: 5}},
|
||||
state: {running: true}
|
||||
},
|
||||
expectedActions: []
|
||||
}, done)
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue