test setOpenCreations mutation in store

This commit is contained in:
Moriz Wahl 2021-12-06 09:27:13 +01:00
parent 61e7493260
commit bef92fe547

View File

@ -1,11 +1,13 @@
import store, { mutations, actions } from './store'
import CONFIG from '../config'
const { token, openCreationsPlus, openCreationsMinus, resetOpenCreations } = mutations
jest.mock('../config')
const { token, openCreationsPlus, openCreationsMinus, resetOpenCreations, setOpenCreations } =
mutations
const { logout } = actions
const CONFIG = {
DEBUG_DISABLE_AUTH: true,
}
CONFIG.DEBUG_DISABLE_AUTH = true
describe('Vuex store', () => {
describe('mutations', () => {
@ -40,6 +42,14 @@ describe('Vuex store', () => {
expect(state.openCreations).toEqual(0)
})
})
describe('setOpenCreations', () => {
it('sets the open creations to given value', () => {
const state = { openCreations: 24 }
setOpenCreations(state, 12)
expect(state.openCreations).toEqual(12)
})
})
})
describe('actions', () => {