From bef92fe547083f5da313408430965d383bb7759b Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Dec 2021 09:27:13 +0100 Subject: [PATCH] test setOpenCreations mutation in store --- admin/src/store/store.test.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/admin/src/store/store.test.js b/admin/src/store/store.test.js index 4482a46bf..7b8784cdd 100644 --- a/admin/src/store/store.test.js +++ b/admin/src/store/store.test.js @@ -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', () => {