First store tests \o/ :party:

This commit is contained in:
Eliot Berriot 2018-01-08 23:12:45 +01:00
parent 91d6a71a21
commit f7d876aec6
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
1 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,52 @@
import store from '@/store/player'
describe('mutations', () => {
it('set volume', () => {
// mock state
const state = { volume: 0 }
// apply mutation
store.mutations.volume(state, 0.9)
// assert result
expect(state.volume).to.equal(0.9)
})
it('set volume max 1', () => {
// mock state
const state = { volume: 0 }
// apply mutation
store.mutations.volume(state, 2)
// assert result
expect(state.volume).to.equal(1)
})
it('set volume min to 0', () => {
// mock state
const state = { volume: 0.5 }
// apply mutation
store.mutations.volume(state, -2)
// assert result
expect(state.volume).to.equal(0)
})
it('increment volume', () => {
// mock state
const state = { volume: 0 }
// apply mutation
store.mutations.incrementVolume(state, 0.1)
// assert result
expect(state.volume).to.equal(0.1)
})
it('increment volume max 1', () => {
// mock state
const state = { volume: 0 }
// apply mutation
store.mutations.incrementVolume(state, 2)
// assert result
expect(state.volume).to.equal(1)
})
it('increment volume min to 0', () => {
// mock state
const state = { volume: 0.5 }
// apply mutation
store.mutations.incrementVolume(state, -2)
// assert result
expect(state.volume).to.equal(0)
})
})