Merge branch 'master' into adminConfirmPendingCreation

This commit is contained in:
Alexander Friedland 2021-12-06 09:58:54 +01:00 committed by GitHub
commit 7d75c0560e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View File

@ -40,6 +40,11 @@ const mocks = {
$toasted: {
error: toastedErrorMock,
},
$moment: jest.fn((value) => {
return {
format: jest.fn((format) => value),
}
}),
}
describe('CreationConfirm', () => {

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', () => {