From 1b485899330b8acfa2523b4c8784167a935280f2 Mon Sep 17 00:00:00 2001 From: elweyn Date: Tue, 30 Nov 2021 08:51:47 +0100 Subject: [PATCH 1/9] Change backend coverage to 39. --- .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 766f9ba3b..66fc1c9f5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 }} ############################################################################## From da649868cc7288220e1e6474e0b89bbe1bb95ac1 Mon Sep 17 00:00:00 2001 From: elweyn Date: Tue, 30 Nov 2021 09:28:59 +0100 Subject: [PATCH 2/9] Removed the remove test that removes all creations, Test that the server sends error. --- admin/src/pages/CreationConfirm.spec.js | 49 +++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/admin/src/pages/CreationConfirm.spec.js b/admin/src/pages/CreationConfirm.spec.js index caf94cd37..365ccd809 100644 --- a/admin/src/pages/CreationConfirm.spec.js +++ b/admin/src/pages/CreationConfirm.spec.js @@ -4,11 +4,42 @@ import CreationConfirm from './CreationConfirm.vue' const localVue = global.localVue const storeCommitMock = jest.fn() +const toastedErrorMock = jest.fn() +const apolloQueryMock = jest.fn().mockResolvedValue({ + data: { + getPendingCreations: [ + { + firstName: 'Bibi', + lastName: 'Bloxberg', + email: 'bibi@bloxberg.de', + amount: 500, + note: 'Danke für alles', + date: new Date(), + moderator: 0, + }, + { + firstName: 'Räuber', + lastName: 'Hotzenplotz', + email: 'raeuber@hotzenplotz.de', + amount: 1000000, + note: 'Gut Ergatert', + date: new Date(), + moderator: 0, + }, + ], + }, +}) const mocks = { $store: { commit: storeCommitMock, }, + $apollo: { + query: apolloQueryMock, + }, + $toasted: { + error: toastedErrorMock, + }, } describe('CreationConfirm', () => { @@ -29,12 +60,22 @@ describe('CreationConfirm', () => { }) describe('store', () => { - it('commits resetOpenCreations to store', () => { - expect(storeCommitMock).toBeCalledWith('resetOpenCreations') + it('commits openCreationsPlus to store', () => { + expect(storeCommitMock).toBeCalledWith('openCreationsPlus', 2) + }) + }) + + describe('server response is error', () => { + beforeEach(() => { + jest.clearAllMocks() + apolloQueryMock.mockRejectedValue({ + message: 'Ouch!', + }) + wrapper = Wrapper() }) - it('commits openCreationsPlus to store', () => { - expect(storeCommitMock).toBeCalledWith('openCreationsPlus', 5) + it('toast an error message', () => { + expect(toastedErrorMock).toBeCalledWith('Ouch!') }) }) From bd5aebbfd539b2f8609a2ff9d13c1a1d185f6038 Mon Sep 17 00:00:00 2001 From: elweyn Date: Tue, 30 Nov 2021 09:30:37 +0100 Subject: [PATCH 3/9] Coverage upgraded to 53% in admin. --- .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 66fc1c9f5..a28680279 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: 52 + min_coverage: 53 token: ${{ github.token }} ############################################################################## From 84be6ae3692818e6edd1af8a1c4b75c1e0569ecc Mon Sep 17 00:00:00 2001 From: elweyn Date: Tue, 30 Nov 2021 09:35:33 +0100 Subject: [PATCH 4/9] Remove empty and unused file. --- admin/src/graphql/getUsersQuery.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 admin/src/graphql/getUsersQuery.ts diff --git a/admin/src/graphql/getUsersQuery.ts b/admin/src/graphql/getUsersQuery.ts deleted file mode 100644 index e69de29bb..000000000 From bdad4197a3a7babcf985f7a08597f1b30941bd14 Mon Sep 17 00:00:00 2001 From: Hannes Heine Date: Tue, 30 Nov 2021 09:41:44 +0100 Subject: [PATCH 5/9] fix logo import Co-authored-by: Moriz Wahl --- admin/src/components/NavBar.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/src/components/NavBar.vue b/admin/src/components/NavBar.vue index ba6bb60ca..a5ee41697 100644 --- a/admin/src/components/NavBar.vue +++ b/admin/src/components/NavBar.vue @@ -2,7 +2,7 @@
- ... + ... From 718763a884d671bf73ebfecf1551adeea5b17141 Mon Sep 17 00:00:00 2001 From: Hannes Heine Date: Tue, 30 Nov 2021 09:42:09 +0100 Subject: [PATCH 6/9] Update admin/src/components/CreationFormular.vue Co-authored-by: Moriz Wahl --- admin/src/components/CreationFormular.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/src/components/CreationFormular.vue b/admin/src/components/CreationFormular.vue index 49e10e7bb..2a31afc6e 100644 --- a/admin/src/components/CreationFormular.vue +++ b/admin/src/components/CreationFormular.vue @@ -54,7 +54,7 @@ - +
From fd54f34855e3a2732eda81ae6a42c8a440cf19e3 Mon Sep 17 00:00:00 2001 From: elweyn Date: Tue, 30 Nov 2021 09:55:27 +0100 Subject: [PATCH 7/9] Remove comment in logout. --- admin/src/components/NavBar.vue | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/admin/src/components/NavBar.vue b/admin/src/components/NavBar.vue index a5ee41697..208a6fa70 100644 --- a/admin/src/components/NavBar.vue +++ b/admin/src/components/NavBar.vue @@ -32,28 +32,8 @@ import CONFIG from '../config' export default { name: 'navbar', - data() { - return { - logo: 'img/brand/green.png', - } - }, methods: { logout() { - // TODO - // this.$emit('logout') - /* this.$apollo - .query({ - query: logout, - }) - .then(() => { - this.$store.dispatch('logout') - this.$router.push('/logout') - }) - .catch(() => { - this.$store.dispatch('logout') - if (this.$router.currentRoute.path !== '/logout') this.$router.push('/logout') - }) - */ this.$store.dispatch('logout') this.$router.push('/logout') }, From e2743b979ef1dd0500284c492e4997a053c0bcec Mon Sep 17 00:00:00 2001 From: elweyn Date: Tue, 30 Nov 2021 10:08:12 +0100 Subject: [PATCH 8/9] Change note to memo. --- admin/src/components/CreationFormular.vue | 4 ++-- backend/src/graphql/arg/CreatePendingCreationArgs.ts | 2 +- backend/src/graphql/resolver/AdminResolver.ts | 4 ++-- database/migrations/0005-admin_tables.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/admin/src/components/CreationFormular.vue b/admin/src/components/CreationFormular.vue index 2a31afc6e..2f7d68c4c 100644 --- a/admin/src/components/CreationFormular.vue +++ b/admin/src/components/CreationFormular.vue @@ -237,7 +237,7 @@ export default { email: this.item.email, creationDate: this.radioSelected.long, amount: this.value, - note: this.text, + memo: this.text, moderator: this.$store.state.moderator.id, }, ] @@ -255,7 +255,7 @@ export default { email: this.item.email, creationDate: this.radioSelected.long, amount: Number(this.value), - note: this.text, + memo: this.text, moderator: Number(this.$store.state.moderator.id), } diff --git a/backend/src/graphql/arg/CreatePendingCreationArgs.ts b/backend/src/graphql/arg/CreatePendingCreationArgs.ts index ed24ed963..d2c17abf1 100644 --- a/backend/src/graphql/arg/CreatePendingCreationArgs.ts +++ b/backend/src/graphql/arg/CreatePendingCreationArgs.ts @@ -9,7 +9,7 @@ export default class CreatePendingCreationArgs { amount: number @Field(() => String) - note: string + memo: string @Field(() => String) creationDate: string diff --git a/backend/src/graphql/resolver/AdminResolver.ts b/backend/src/graphql/resolver/AdminResolver.ts index f08b1a4dc..4c9cb33f8 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -31,7 +31,7 @@ export class AdminResolver { @Query(() => [Number]) async createPendingCreation( - @Args() { email, amount, note, creationDate, moderator }: CreatePendingCreationArgs, + @Args() { email, amount, memo, creationDate, moderator }: CreatePendingCreationArgs, ): Promise { const userRepository = getCustomRepository(UserRepository) const user = await userRepository.findByEmail(email) @@ -45,7 +45,7 @@ export class AdminResolver { loginPendingTaskAdmin.amount = BigInt(amount * 10000) loginPendingTaskAdmin.created = new Date() loginPendingTaskAdmin.date = creationDateObj - loginPendingTaskAdmin.note = note + loginPendingTaskAdmin.memo = memo loginPendingTaskAdmin.moderator = moderator pendingCreationRepository.save(loginPendingTaskAdmin) diff --git a/database/migrations/0005-admin_tables.ts b/database/migrations/0005-admin_tables.ts index 8e1219715..6398b22fc 100644 --- a/database/migrations/0005-admin_tables.ts +++ b/database/migrations/0005-admin_tables.ts @@ -16,7 +16,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis \`userId\` int UNSIGNED DEFAULT 0, \`created\` datetime NOT NULL, \`date\` datetime NOT NULL, - \`note\` text DEFAULT NULL, + \`memo\` text DEFAULT NULL, \`amount\` bigint(20) NOT NULL, \`moderator\` int UNSIGNED DEFAULT 0, PRIMARY KEY (\`id\`) From 3a5999ffe5486f4b89015769785383aca22f55ef Mon Sep 17 00:00:00 2001 From: elweyn Date: Tue, 30 Nov 2021 10:11:28 +0100 Subject: [PATCH 9/9] Change note to memo. --- backend/src/graphql/model/PendingCreation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/model/PendingCreation.ts b/backend/src/graphql/model/PendingCreation.ts index aa12bd94b..f1087ea0b 100644 --- a/backend/src/graphql/model/PendingCreation.ts +++ b/backend/src/graphql/model/PendingCreation.ts @@ -21,7 +21,7 @@ export class PendingCreation { date: Date @Field(() => String) - note: string + memo: string @Field(() => Number) amount: BigInt