From 32f8e43c90e24b43201886faab70f596cc82f6be Mon Sep 17 00:00:00 2001 From: ogerly Date: Sun, 29 May 2022 12:08:28 +0200 Subject: [PATCH] remove files and code from coinanimation settings --- .../UserSettings/UserCoinAnimation.spec.js | 127 ------------------ .../UserSettings/UserCoinAnimation.vue | 65 --------- frontend/src/graphql/mutations.js | 2 - frontend/src/graphql/queries.js | 2 - frontend/src/locales/de.json | 5 - frontend/src/locales/en.json | 5 - frontend/src/pages/Profile.spec.js | 4 - frontend/src/pages/Profile.vue | 4 - frontend/src/store/store.js | 6 - frontend/src/store/store.test.js | 40 ++---- 10 files changed, 10 insertions(+), 250 deletions(-) delete mode 100644 frontend/src/components/UserSettings/UserCoinAnimation.spec.js delete mode 100644 frontend/src/components/UserSettings/UserCoinAnimation.vue diff --git a/frontend/src/components/UserSettings/UserCoinAnimation.spec.js b/frontend/src/components/UserSettings/UserCoinAnimation.spec.js deleted file mode 100644 index aabf927fb..000000000 --- a/frontend/src/components/UserSettings/UserCoinAnimation.spec.js +++ /dev/null @@ -1,127 +0,0 @@ -import { mount } from '@vue/test-utils' -import UserCoinAnimation from './UserCoinAnimation' -import { updateUserInfos } from '@/graphql/mutations' - -import { toastErrorSpy, toastSuccessSpy } from '@test/testSetup' - -const localVue = global.localVue - -const mockAPIcall = jest.fn() - -const storeCommitMock = jest.fn() - -describe('UserCard_CoinAnimation', () => { - let wrapper - - const mocks = { - $t: jest.fn((t) => t), - $store: { - state: { - language: 'de', - coinanimation: true, - }, - commit: storeCommitMock, - }, - $apollo: { - mutate: mockAPIcall, - }, - } - - const Wrapper = () => { - return mount(UserCoinAnimation, { localVue, mocks }) - } - - describe('mount', () => { - beforeEach(() => { - jest.clearAllMocks() - wrapper = Wrapper() - }) - - it('renders the component', () => { - expect(wrapper.find('div#formusercoinanimation').exists()).toBeTruthy() - }) - - it('has an edit BFormCheckbox switch', () => { - expect(wrapper.find('.Test-BFormCheckbox').exists()).toBeTruthy() - }) - - describe('enable with success', () => { - beforeEach(async () => { - await wrapper.setData({ CoinAnimationStatus: false }) - mockAPIcall.mockResolvedValue({ - data: { - updateUserInfos: { - validValues: 1, - }, - }, - }) - await wrapper.find('input').setChecked() - }) - - it('calls the updateUserInfos mutation', () => { - expect(mockAPIcall).toBeCalledWith({ - mutation: updateUserInfos, - variables: { - coinanimation: true, - }, - }) - }) - - it('updates the store', () => { - expect(storeCommitMock).toBeCalledWith('coinanimation', true) - }) - - it('toasts a success message', () => { - expect(toastSuccessSpy).toBeCalledWith('settings.coinanimation.True') - }) - }) - - describe('disable with success', () => { - beforeEach(async () => { - await wrapper.setData({ CoinAnimationStatus: true }) - mockAPIcall.mockResolvedValue({ - data: { - updateUserInfos: { - validValues: 1, - }, - }, - }) - await wrapper.find('input').setChecked(false) - }) - - it('calls the subscribe mutation', () => { - expect(mockAPIcall).toBeCalledWith({ - mutation: updateUserInfos, - variables: { - coinanimation: false, - }, - }) - }) - - it('updates the store', () => { - expect(storeCommitMock).toBeCalledWith('coinanimation', false) - }) - - it('toasts a success message', () => { - expect(toastSuccessSpy).toBeCalledWith('settings.coinanimation.False') - }) - }) - - describe('disable with server error', () => { - beforeEach(() => { - mockAPIcall.mockRejectedValue({ - message: 'Ouch', - }) - wrapper.find('input').trigger('change') - }) - - it('resets the CoinAnimationStatus', () => { - expect(wrapper.vm.CoinAnimationStatus).toBeTruthy() - }) - - it('toasts an error message', () => { - expect(toastErrorSpy).toBeCalledWith('Ouch') - }) - }) - }) -}) diff --git a/frontend/src/components/UserSettings/UserCoinAnimation.vue b/frontend/src/components/UserSettings/UserCoinAnimation.vue deleted file mode 100644 index 040825105..000000000 --- a/frontend/src/components/UserSettings/UserCoinAnimation.vue +++ /dev/null @@ -1,65 +0,0 @@ - - diff --git a/frontend/src/graphql/mutations.js b/frontend/src/graphql/mutations.js index 672af5f04..9b035cba6 100644 --- a/frontend/src/graphql/mutations.js +++ b/frontend/src/graphql/mutations.js @@ -31,7 +31,6 @@ export const updateUserInfos = gql` $password: String $passwordNew: String $locale: String - $coinanimation: Boolean ) { updateUserInfos( firstName: $firstName @@ -39,7 +38,6 @@ export const updateUserInfos = gql` password: $password passwordNew: $passwordNew language: $locale - coinanimation: $coinanimation ) } ` diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index 2bd905e5e..601880a51 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -7,7 +7,6 @@ export const login = gql` firstName lastName language - coinanimation klickTipp { newsletterState } @@ -25,7 +24,6 @@ export const verifyLogin = gql` firstName lastName language - coinanimation klickTipp { newsletterState } diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 3b4912a2f..a3e412a0e 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -186,11 +186,6 @@ "send_gdd": "GDD versenden", "send_per_link": "GDD versenden per Link", "settings": { - "coinanimation": { - "coinanimation": "Münzanimation", - "False": "Münzanimation ausgeschaltet", - "True": "Münzanimation eingeschaltet" - }, "language": { "changeLanguage": "Sprache ändern", "de": "Deutsch", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 63f2510a3..4a7245147 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -186,11 +186,6 @@ "send_gdd": "GDD send", "send_per_link": "GDD send via link", "settings": { - "coinanimation": { - "coinanimation": "Coin animation", - "False": "Coin animation disabled", - "True": "Coin animation enabled" - }, "language": { "changeLanguage": "Change language", "de": "Deutsch", diff --git a/frontend/src/pages/Profile.spec.js b/frontend/src/pages/Profile.spec.js index fb4ee2d42..6a6efcfe3 100644 --- a/frontend/src/pages/Profile.spec.js +++ b/frontend/src/pages/Profile.spec.js @@ -38,9 +38,5 @@ describe('Profile', () => { it('has a user change newsletter form', () => { expect(wrapper.findComponent({ name: 'UserNewsletter' }).exists()).toBeTruthy() }) - - it('has a user change coin animation form', () => { - expect(wrapper.findComponent({ name: 'UserCoinAnimation' }).exists()).toBeTruthy() - }) }) }) diff --git a/frontend/src/pages/Profile.vue b/frontend/src/pages/Profile.vue index 01308b29a..703fea307 100644 --- a/frontend/src/pages/Profile.vue +++ b/frontend/src/pages/Profile.vue @@ -8,8 +8,6 @@
-
-