From e60f06bb9b969c37d8d519d24dd401a501f1003e Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 15 Jun 2022 08:32:30 +0200 Subject: [PATCH] rename mutations to create admin contributions --- admin/src/components/CreationFormular.spec.js | 14 ++--- admin/src/components/CreationFormular.vue | 16 +++--- admin/src/graphql/adminCreateContribution.js | 12 +++++ ...eations.js => adminCreateContributions.js} | 4 +- admin/src/graphql/createPendingCreation.js | 7 --- .../graphql/resolver/AdminResolver.test.ts | 54 ++++++++++--------- backend/src/graphql/resolver/AdminResolver.ts | 8 +-- backend/src/seeds/factory/creation.ts | 4 +- backend/src/seeds/graphql/mutations.ts | 13 +++-- 9 files changed, 74 insertions(+), 58 deletions(-) create mode 100644 admin/src/graphql/adminCreateContribution.js rename admin/src/graphql/{createPendingCreations.js => adminCreateContributions.js} (59%) delete mode 100644 admin/src/graphql/createPendingCreation.js diff --git a/admin/src/components/CreationFormular.spec.js b/admin/src/components/CreationFormular.spec.js index 08ec71bdc..6c89ec727 100644 --- a/admin/src/components/CreationFormular.spec.js +++ b/admin/src/components/CreationFormular.spec.js @@ -1,14 +1,14 @@ import { mount } from '@vue/test-utils' import CreationFormular from './CreationFormular.vue' -import { createPendingCreation } from '../graphql/createPendingCreation' -import { createPendingCreations } from '../graphql/createPendingCreations' +import { adminCreateContribution } from '../graphql/adminCreateContribution' +import { adminCreateContributions } from '../graphql/adminCreateContributions' import { toastErrorSpy, toastSuccessSpy } from '../../test/testSetup' const localVue = global.localVue const apolloMutateMock = jest.fn().mockResolvedValue({ data: { - createPendingCreation: [0, 0, 0], + adminCreateContribution: [0, 0, 0], }, }) const stateCommitMock = jest.fn() @@ -110,7 +110,7 @@ describe('CreationFormular', () => { it('sends ... to apollo', () => { expect(apolloMutateMock).toBeCalledWith( expect.objectContaining({ - mutation: createPendingCreation, + mutation: adminCreateContribution, variables: { email: 'benjamin@bluemchen.de', creationDate: getCreationDate(2), @@ -334,7 +334,7 @@ describe('CreationFormular', () => { jest.clearAllMocks() apolloMutateMock.mockResolvedValue({ data: { - createPendingCreations: { + adminCreateContributions: { success: true, successfulCreation: ['bob@baumeister.de', 'bibi@bloxberg.de'], failedCreation: [], @@ -355,7 +355,7 @@ describe('CreationFormular', () => { it('calls the API', () => { expect(apolloMutateMock).toBeCalledWith( expect.objectContaining({ - mutation: createPendingCreations, + mutation: adminCreateContributions, variables: { pendingCreations: [ { @@ -390,7 +390,7 @@ describe('CreationFormular', () => { jest.clearAllMocks() apolloMutateMock.mockResolvedValue({ data: { - createPendingCreations: { + adminCreateContributions: { success: true, successfulCreation: [], failedCreation: ['bob@baumeister.de', 'bibi@bloxberg.de'], diff --git a/admin/src/components/CreationFormular.vue b/admin/src/components/CreationFormular.vue index cdcd6ef1d..8531eaa16 100644 --- a/admin/src/components/CreationFormular.vue +++ b/admin/src/components/CreationFormular.vue @@ -85,8 +85,8 @@