From 61e749326009aed8db99d65bcd9775ccdb23a600 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Dec 2021 09:22:07 +0100 Subject: [PATCH 1/3] mock moment in CreationConfirm Spec --- admin/src/pages/CreationConfirm.spec.js | 5 +++++ 1 file changed, 5 insertions(+) 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', () => { From bef92fe547083f5da313408430965d383bb7759b Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Dec 2021 09:27:13 +0100 Subject: [PATCH 2/3] 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', () => { From d18b3d269dde5c94d2e31ff6e9c071b120808d99 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Dec 2021 09:28:30 +0100 Subject: [PATCH 3/3] test coverage admin interface to 52% --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4967be67d..66fc1c9f5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -441,7 +441,7 @@ jobs: report_name: Coverage Admin Interface type: lcov result_path: ./coverage/lcov.info - min_coverage: 51 + min_coverage: 52 token: ${{ github.token }} ##############################################################################