diff --git a/admin/src/pages/CreationConfirm.spec.js b/admin/src/pages/CreationConfirm.spec.js index cd7edf680..86f90231b 100644 --- a/admin/src/pages/CreationConfirm.spec.js +++ b/admin/src/pages/CreationConfirm.spec.js @@ -40,6 +40,11 @@ const mocks = { $toasted: { error: toastedErrorMock, }, + $moment: jest.fn((value) => { + return { + format: jest.fn((format) => value), + } + }), } describe('CreationConfirm', () => { 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', () => {