diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a64dc057e..acff97d0e 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: 49 + min_coverage: 50 token: ${{ github.token }} ############################################################################## @@ -491,7 +491,7 @@ jobs: report_name: Coverage Backend type: lcov result_path: ./backend/coverage/lcov.info - min_coverage: 37 + min_coverage: 39 token: ${{ github.token }} ############################################################################## diff --git a/admin/package.json b/admin/package.json index e3c94f5d8..9d70c0b06 100644 --- a/admin/package.json +++ b/admin/package.json @@ -43,6 +43,7 @@ "vue-jest": "^3.0.7", "vue-moment": "^4.1.0", "vue-router": "^3.5.3", + "vue-toasted": "^1.1.28", "vuex": "^3.6.2", "vuex-persistedstate": "^4.1.0" }, diff --git a/admin/public/img/brand/green.png b/admin/public/img/brand/green.png new file mode 100644 index 000000000..bb7f12c39 Binary files /dev/null and b/admin/public/img/brand/green.png differ diff --git a/admin/src/components/CreationFormular.spec.js b/admin/src/components/CreationFormular.spec.js index fcdf97cfa..e1bbff1cc 100644 --- a/admin/src/components/CreationFormular.spec.js +++ b/admin/src/components/CreationFormular.spec.js @@ -3,6 +3,16 @@ import CreationFormular from './CreationFormular.vue' const localVue = global.localVue +const apolloMock = jest.fn().mockResolvedValue({ + data: { + verifyLogin: { + name: 'success', + id: 0, + }, + }, +}) +const stateCommitMock = jest.fn() + const mocks = { $moment: jest.fn(() => { return { @@ -14,6 +24,12 @@ const mocks = { }), } }), + $apollo: { + query: apolloMock, + }, + $store: { + commit: stateCommitMock, + }, } const propsData = { @@ -39,6 +55,23 @@ describe('CreationFormular', () => { expect(wrapper.find('.component-creation-formular').exists()).toBeTruthy() }) + describe('server sends back moderator data', () => { + it('called store commit with mocked data', () => { + expect(stateCommitMock).toBeCalledWith('moderator', { name: 'success', id: 0 }) + }) + }) + + describe('server throws error for moderator data call', () => { + beforeEach(() => { + jest.clearAllMocks() + apolloMock.mockRejectedValue({ message: 'Ouch!' }) + wrapper = Wrapper() + }) + it('has called store commit with fake data', () => { + expect(stateCommitMock).toBeCalledWith('moderator', { id: 0, name: 'Test Moderator' }) + }) + }) + describe('radio buttons to selcet month', () => { it('has three radio buttons', () => { expect(wrapper.findAll('input[type="radio"]').length).toBe(3) diff --git a/admin/src/components/CreationFormular.vue b/admin/src/components/CreationFormular.vue index d6b637152..b6a12433e 100644 --- a/admin/src/components/CreationFormular.vue +++ b/admin/src/components/CreationFormular.vue @@ -7,7 +7,6 @@ ? 'Einzelschöpfung für ' + item.firstName + ' ' + item.lastName + '' : 'Mehrfachschöpfung für ' + Object.keys(this.itemsMassCreation).length + ' Mitglieder' }} - {{ item }}
Bitte wähle ein oder Mehrere Mitglieder aus für die du Schöpfen möchtest @@ -24,6 +23,7 @@ @@ -34,6 +34,7 @@ @@ -44,6 +45,7 @@ @@ -52,30 +54,29 @@ - + - - - - +
+ + + - + + + +
@@ -125,6 +126,8 @@
diff --git a/admin/src/components/NavBar.spec.js b/admin/src/components/NavBar.spec.js index 1d68b16ad..ad3ed54fd 100644 --- a/admin/src/components/NavBar.spec.js +++ b/admin/src/components/NavBar.spec.js @@ -3,11 +3,19 @@ import NavBar from './NavBar.vue' const localVue = global.localVue +const storeDispatchMock = jest.fn() +const routerPushMock = jest.fn() + const mocks = { $store: { state: { openCreations: 1, + token: 'valid-token', }, + dispatch: storeDispatchMock, + }, + $router: { + push: routerPushMock, }, } @@ -27,4 +35,34 @@ describe('NavBar', () => { expect(wrapper.find('.component-nabvar').exists()).toBeTruthy() }) }) + + describe('wallet', () => { + const assignLocationSpy = jest.fn() + beforeEach(async () => { + await wrapper.findAll('a').at(5).trigger('click') + }) + + it.skip('changes widnow location to wallet', () => { + expect(assignLocationSpy).toBeCalledWith('valid-token') + }) + + it('dispatches logout to store', () => { + expect(storeDispatchMock).toBeCalledWith('logout') + }) + }) + + describe('logout', () => { + // const assignLocationSpy = jest.fn() + beforeEach(async () => { + await wrapper.findAll('a').at(6).trigger('click') + }) + + it('redirects to /logout', () => { + expect(routerPushMock).toBeCalledWith('/logout') + }) + + it('dispatches logout to store', () => { + expect(storeDispatchMock).toBeCalledWith('logout') + }) + }) }) diff --git a/admin/src/components/NavBar.vue b/admin/src/components/NavBar.vue index c52743857..208a6fa70 100644 --- a/admin/src/components/NavBar.vue +++ b/admin/src/components/NavBar.vue @@ -1,12 +1,15 @@