mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
test store
This commit is contained in:
parent
c98d615105
commit
50e1a16f83
@ -6,10 +6,10 @@ Vue.use(Vuex)
|
||||
|
||||
export const mutations = {
|
||||
openCreationsPlus: (state, i) => {
|
||||
state.openCreations = state.openCreations + i
|
||||
state.openCreations += i
|
||||
},
|
||||
openCreationsMinus: (state, i) => {
|
||||
state.openCreations = state.openCreations - i
|
||||
state.openCreations -= i
|
||||
},
|
||||
resetOpenCreations: (state) => {
|
||||
state.openCreations = 0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { mutations } from './store'
|
||||
|
||||
const { token } = mutations
|
||||
const { token, openCreationsPlus, openCreationsMinus, resetOpenCreations } = mutations
|
||||
|
||||
describe('Vuex store', () => {
|
||||
describe('mutations', () => {
|
||||
@ -11,5 +11,29 @@ describe('Vuex store', () => {
|
||||
expect(state.token).toEqual('1234')
|
||||
})
|
||||
})
|
||||
|
||||
describe('openCreationsPlus', () => {
|
||||
it('increases the open creations by a given number', () => {
|
||||
const state = { openCreations: 0 }
|
||||
openCreationsPlus(state, 12)
|
||||
expect(state.openCreations).toEqual(12)
|
||||
})
|
||||
})
|
||||
|
||||
describe('openCreationsMinus', () => {
|
||||
it('decreases the open creations by a given number', () => {
|
||||
const state = { openCreations: 12 }
|
||||
openCreationsMinus(state, 2)
|
||||
expect(state.openCreations).toEqual(10)
|
||||
})
|
||||
})
|
||||
|
||||
describe('resetOpenCreations', () => {
|
||||
it('sets the open creations to 0', () => {
|
||||
const state = { openCreations: 24 }
|
||||
resetOpenCreations(state)
|
||||
expect(state.openCreations).toEqual(0)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user