From d1d65dbac39bdac8ce31db85e06370d569e7ded4 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 31 Oct 2022 12:12:07 +0100 Subject: [PATCH] new Page ContributionLink,vue --- .../ContributionLink.spec.js | 0 .../ContributionLink.vue | 4 +- .../ContributionLinkForm.spec.js | 2 +- .../ContributionLinkForm.vue | 0 .../ContributionLinkList.spec.js | 2 +- .../ContributionLinkList.vue | 2 +- admin/src/components/NavBar.spec.js | 4 +- admin/src/components/NavBar.vue | 1 + admin/src/locales/de.json | 3 +- admin/src/locales/en.json | 3 +- admin/src/pages/ContributionLink.spec.js | 58 +++++++++++++++++++ admin/src/pages/ContributionLink.vue | 45 ++++++++++++++ admin/src/pages/Overview.spec.js | 30 ---------- admin/src/pages/Overview.vue | 25 -------- admin/src/router/router.test.js | 9 ++- admin/src/router/routes.js | 4 ++ 16 files changed, 127 insertions(+), 65 deletions(-) rename admin/src/components/{ => ContributionLink}/ContributionLink.spec.js (100%) rename admin/src/components/{ => ContributionLink}/ContributionLink.vue (92%) rename admin/src/components/{ => ContributionLink}/ContributionLinkForm.spec.js (98%) rename admin/src/components/{ => ContributionLink}/ContributionLinkForm.vue (100%) rename admin/src/components/{ => ContributionLink}/ContributionLinkList.spec.js (98%) rename admin/src/components/{ => ContributionLink}/ContributionLinkList.vue (98%) create mode 100644 admin/src/pages/ContributionLink.spec.js create mode 100644 admin/src/pages/ContributionLink.vue diff --git a/admin/src/components/ContributionLink.spec.js b/admin/src/components/ContributionLink/ContributionLink.spec.js similarity index 100% rename from admin/src/components/ContributionLink.spec.js rename to admin/src/components/ContributionLink/ContributionLink.spec.js diff --git a/admin/src/components/ContributionLink.vue b/admin/src/components/ContributionLink/ContributionLink.vue similarity index 92% rename from admin/src/components/ContributionLink.vue rename to admin/src/components/ContributionLink/ContributionLink.vue index 0ae9c76b2..a2d171d56 100644 --- a/admin/src/components/ContributionLink.vue +++ b/admin/src/components/ContributionLink/ContributionLink.vue @@ -36,8 +36,8 @@ diff --git a/admin/src/pages/Overview.spec.js b/admin/src/pages/Overview.spec.js index 1861c5330..affd018a7 100644 --- a/admin/src/pages/Overview.spec.js +++ b/admin/src/pages/Overview.spec.js @@ -1,6 +1,5 @@ import { mount } from '@vue/test-utils' import Overview from './Overview.vue' -import { listContributionLinks } from '@/graphql/listContributionLinks.js' import { communityStatistics } from '@/graphql/communityStatistics.js' import { listUnconfirmedContributions } from '@/graphql/listUnconfirmedContributions.js' @@ -36,27 +35,6 @@ const apolloQueryMock = jest }, }, }) - .mockResolvedValueOnce({ - data: { - listContributionLinks: { - links: [ - { - id: 1, - name: 'Meditation', - memo: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut l', - amount: '200', - validFrom: '2022-04-01', - validTo: '2022-08-01', - cycle: 'täglich', - maxPerCycle: '3', - maxAmountPerMonth: 0, - link: 'https://localhost/redeem/CL-1a2345678', - }, - ], - count: 1, - }, - }, - }) .mockResolvedValue({ data: { listUnconfirmedContributions: [ @@ -118,14 +96,6 @@ describe('Overview', () => { ) }) - it('calls listContributionLinks', () => { - expect(apolloQueryMock).toBeCalledWith( - expect.objectContaining({ - query: listContributionLinks, - }), - ) - }) - it('commits three pending creations to store', () => { expect(storeCommitMock).toBeCalledWith('setOpenCreations', 3) }) diff --git a/admin/src/pages/Overview.vue b/admin/src/pages/Overview.vue index cfa247b8e..57bf7ff8c 100644 --- a/admin/src/pages/Overview.vue +++ b/admin/src/pages/Overview.vue @@ -28,31 +28,21 @@ - diff --git a/admin/src/router/router.test.js b/admin/src/router/router.test.js index eb9b646cb..bf2e724d2 100644 --- a/admin/src/router/router.test.js +++ b/admin/src/router/router.test.js @@ -45,7 +45,7 @@ describe('router', () => { describe('routes', () => { it('has seven routes defined', () => { - expect(routes).toHaveLength(7) + expect(routes).toHaveLength(8) }) it('has "/overview" as default', async () => { @@ -81,6 +81,13 @@ describe('router', () => { }) }) + describe('contribution-link', () => { + it('loads the "ContributionLink" component', async () => { + const component = await routes.find((r) => r.path === '/contribution-link').component() + expect(component.default.name).toBe('ContributionLinks') + }) + }) + describe('not found page', () => { it('renders the "NotFound" component', async () => { const component = await routes.find((r) => r.path === '*').component() diff --git a/admin/src/router/routes.js b/admin/src/router/routes.js index 72e7b1ac5..caf1030a1 100644 --- a/admin/src/router/routes.js +++ b/admin/src/router/routes.js @@ -23,6 +23,10 @@ const routes = [ path: '/creation-confirm', component: () => import('@/pages/CreationConfirm.vue'), }, + { + path: '/contribution-link', + component: () => import('@/pages/ContributionLink.vue'), + }, { path: '*', component: () => import('@/components/NotFoundPage.vue'),