diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js index e779f5928..d12c5e43e 100644 --- a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js +++ b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js @@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils' import flushPromises from 'flush-promises' import DashboardLayoutGdd from './DashboardLayout_gdd' -import { toasters } from '../../mixins/toaster' +import { toastErrorSpy } from '../../../test/testSetup' jest.useFakeTimers() @@ -19,8 +19,6 @@ const apolloMock = jest.fn().mockResolvedValue({ }, }) -const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') - describe('DashboardLayoutGdd', () => { let wrapper diff --git a/frontend/src/views/Pages/AccountOverview/GdtTransactionList.spec.js b/frontend/src/views/Pages/AccountOverview/GdtTransactionList.spec.js index 16c9de309..42c03b8a3 100644 --- a/frontend/src/views/Pages/AccountOverview/GdtTransactionList.spec.js +++ b/frontend/src/views/Pages/AccountOverview/GdtTransactionList.spec.js @@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils' import { GdtEntryType } from '../../../graphql/enums' import GdtTransactionList from './GdtTransactionList' -import { toasters } from '../../../mixins/toaster' +import { toastErrorSpy } from '../../../../test/testSetup' const localVue = global.localVue @@ -17,8 +17,6 @@ const apolloMock = jest.fn().mockResolvedValue({ const windowScrollToMock = jest.fn() -const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') - window.scrollTo = windowScrollToMock const state = { diff --git a/frontend/src/views/Pages/Login.spec.js b/frontend/src/views/Pages/Login.spec.js index 464879da8..3035c15eb 100644 --- a/frontend/src/views/Pages/Login.spec.js +++ b/frontend/src/views/Pages/Login.spec.js @@ -2,7 +2,7 @@ import { RouterLinkStub, mount } from '@vue/test-utils' import flushPromises from 'flush-promises' import Login from './Login' -import { toasters } from '../../mixins/toaster' +import { toastErrorSpy } from '../../../test/testSetup' const localVue = global.localVue @@ -27,8 +27,6 @@ const spinnerMock = jest.fn(() => { } }) -const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') - describe('Login', () => { let wrapper diff --git a/frontend/src/views/Pages/Register.spec.js b/frontend/src/views/Pages/Register.spec.js index 7065f4638..4ec3cc0a2 100644 --- a/frontend/src/views/Pages/Register.spec.js +++ b/frontend/src/views/Pages/Register.spec.js @@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils' import flushPromises from 'flush-promises' import Register from './Register' -import { toasters } from '../../mixins/toaster' +import { toastErrorSpy } from '../../../test/testSetup' const localVue = global.localVue @@ -21,8 +21,6 @@ const mockStoreCommit = jest.fn() const registerUserMutationMock = jest.fn() const routerPushMock = jest.fn() -const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') - describe('Register', () => { let wrapper diff --git a/frontend/src/views/Pages/RegisterCommunity.spec.js b/frontend/src/views/Pages/RegisterCommunity.spec.js index f29ea5386..b1215a609 100644 --- a/frontend/src/views/Pages/RegisterCommunity.spec.js +++ b/frontend/src/views/Pages/RegisterCommunity.spec.js @@ -1,7 +1,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils' import RegisterCommunity from './RegisterCommunity' -import { toasters } from '../../mixins/toaster' +import { toastErrorSpy } from '../../../test/testSetup' const localVue = global.localVue @@ -18,8 +18,6 @@ const apolloQueryMock = jest.fn().mockResolvedValue({ const mockStoreCommit = jest.fn() -const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') - describe('RegisterCommunity', () => { let wrapper diff --git a/frontend/src/views/Pages/RegisterSelectCommunity.spec.js b/frontend/src/views/Pages/RegisterSelectCommunity.spec.js index 540f448cb..d2a13fb4e 100644 --- a/frontend/src/views/Pages/RegisterSelectCommunity.spec.js +++ b/frontend/src/views/Pages/RegisterSelectCommunity.spec.js @@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils' import { communities, communityInfo } from '../../graphql/queries' import RegisterSelectCommunity from './RegisterSelectCommunity' -import { toasters } from '../../mixins/toaster' +import { toastErrorSpy } from '../../../test/testSetup' const localVue = global.localVue @@ -14,8 +14,6 @@ const spinnerMock = jest.fn(() => { } }) -const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') - const apolloQueryMock = jest .fn() .mockResolvedValueOnce({ diff --git a/frontend/src/views/Pages/ResetPassword.spec.js b/frontend/src/views/Pages/ResetPassword.spec.js index eb04d2c05..5ee2742f2 100644 --- a/frontend/src/views/Pages/ResetPassword.spec.js +++ b/frontend/src/views/Pages/ResetPassword.spec.js @@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils' import ResetPassword from './ResetPassword' import flushPromises from 'flush-promises' -import { toasters } from '../../mixins/toaster' +import { toastErrorSpy } from '../../../test/testSetup' // validation is tested in src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js @@ -12,8 +12,6 @@ const apolloMutationMock = jest.fn() const routerPushMock = jest.fn() -const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') - const stubs = { RouterLink: RouterLinkStub, } diff --git a/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.spec.js b/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.spec.js index e2824308c..4cc4477b1 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.spec.js +++ b/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.spec.js @@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils' import UserCardCoinAnimation from './UserCard_CoinAnimation' import { updateUserInfos } from '../../../graphql/mutations' -import { toasters } from '../../../mixins/toaster' +import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup' const localVue = global.localVue @@ -10,9 +10,6 @@ const mockAPIcall = jest.fn() const storeCommitMock = jest.fn() -const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') -const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess') - describe('UserCard_CoinAnimation', () => { let wrapper diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.spec.js b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.spec.js index 11807614c..c86a335c7 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.spec.js +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.spec.js @@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils' import UserCardFormUserData from './UserCard_FormUserData' import flushPromises from 'flush-promises' -import { toasters } from '../../../mixins/toaster' +import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup' const localVue = global.localVue @@ -10,9 +10,6 @@ const mockAPIcall = jest.fn() const storeCommitMock = jest.fn() -const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') -const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess') - describe('UserCard_FormUserData', () => { let wrapper diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js index cf870f179..0299bdc1b 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js @@ -2,16 +2,13 @@ import { mount } from '@vue/test-utils' import UserCardFormPasswort from './UserCard_FormUserPasswort' import flushPromises from 'flush-promises' -import { toasters } from '../../../mixins/toaster' +import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup' const localVue = global.localVue const changePasswordProfileMock = jest.fn() changePasswordProfileMock.mockReturnValue({ success: true }) -const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') -const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess') - describe('UserCard_FormUserPasswort', () => { let wrapper diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.spec.js.old b/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.spec.js.old index 28451e781..58ad2ecdd 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.spec.js.old +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.spec.js.old @@ -3,7 +3,7 @@ import UserCardFormUsername from './UserCard_FormUsername' import flushPromises from 'flush-promises' import { extend } from 'vee-validate' -import { toasters } from '../../../mixins/toaster' +import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup' const localVue = global.localVue @@ -18,9 +18,6 @@ extend('gddUsernameUnique', { const storeCommitMock = jest.fn() -const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') -const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess') - describe('UserCard_FormUsername', () => { let wrapper diff --git a/frontend/src/views/Pages/UserProfile/UserCard_Language.spec.js b/frontend/src/views/Pages/UserProfile/UserCard_Language.spec.js index 74ed9f73f..e30632cec 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_Language.spec.js +++ b/frontend/src/views/Pages/UserProfile/UserCard_Language.spec.js @@ -1,7 +1,7 @@ import { mount } from '@vue/test-utils' import UserCardLanguage from './UserCard_Language' -import { toasters } from '../../../mixins/toaster' +import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup' const localVue = global.localVue @@ -15,9 +15,6 @@ const mockAPIcall = jest.fn().mockResolvedValue({ const storeCommitMock = jest.fn() -const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') -const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess') - describe('UserCard_Language', () => { let wrapper diff --git a/frontend/src/views/Pages/UserProfile/UserCard_Newsletter.spec.js b/frontend/src/views/Pages/UserProfile/UserCard_Newsletter.spec.js index b5a014b51..1f552807f 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_Newsletter.spec.js +++ b/frontend/src/views/Pages/UserProfile/UserCard_Newsletter.spec.js @@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils' import UserCardNewsletter from './UserCard_Newsletter' import { unsubscribeNewsletter, subscribeNewsletter } from '../../../graphql/mutations' -import { toasters } from '../../../mixins/toaster' +import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup' const localVue = global.localVue @@ -10,9 +10,6 @@ const mockAPIcall = jest.fn() const storeCommitMock = jest.fn() -const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') -const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess') - describe('UserCard_Newsletter', () => { let wrapper diff --git a/frontend/test/testSetup.js b/frontend/test/testSetup.js index 2bd15f43a..3a4efd4c6 100644 --- a/frontend/test/testSetup.js +++ b/frontend/test/testSetup.js @@ -18,6 +18,8 @@ import { focus } from 'vue-focus' import { loadAllRules } from '../src/validation-rules' import { toasters } from '../src/mixins/toaster' +export const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') +export const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess') Object.keys(rules).forEach((rule) => { extend(rule, {