diff --git a/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.spec.js b/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.spec.js index 64455a3e8..e2824308c 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.spec.js +++ b/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.spec.js @@ -2,14 +2,17 @@ import { mount } from '@vue/test-utils' import UserCardCoinAnimation from './UserCard_CoinAnimation' import { updateUserInfos } from '../../../graphql/mutations' +import { toasters } from '../../../mixins/toaster' + const localVue = global.localVue const mockAPIcall = jest.fn() -const toastErrorMock = jest.fn() -const toastSuccessMock = 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 @@ -22,12 +25,6 @@ describe('UserCard_CoinAnimation', () => { }, commit: storeCommitMock, }, - $toasted: { - success: toastSuccessMock, - global: { - error: toastErrorMock, - }, - }, $apollo: { mutate: mockAPIcall, }, @@ -78,7 +75,7 @@ describe('UserCard_CoinAnimation', () => { }) it('toasts a success message', () => { - expect(toastSuccessMock).toBeCalledWith('settings.coinanimation.True') + expect(toastSuccessSpy).toBeCalledWith('settings.coinanimation.True') }) }) @@ -109,7 +106,7 @@ describe('UserCard_CoinAnimation', () => { }) it('toasts a success message', () => { - expect(toastSuccessMock).toBeCalledWith('settings.coinanimation.False') + expect(toastSuccessSpy).toBeCalledWith('settings.coinanimation.False') }) }) @@ -126,7 +123,7 @@ describe('UserCard_CoinAnimation', () => { }) it('toasts an error message', () => { - expect(toastErrorMock).toBeCalledWith('Ouch') + expect(toastErrorSpy).toBeCalledWith('Ouch') }) }) }) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.vue b/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.vue index 99d46ae9b..8f68224a9 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.vue @@ -50,7 +50,7 @@ export default { }) .then(() => { this.$store.commit('coinanimation', this.CoinAnimationStatus) - this.$toasted.success( + this.toastSuccess( this.CoinAnimationStatus ? this.$t('settings.coinanimation.True') : this.$t('settings.coinanimation.False'), @@ -58,7 +58,7 @@ export default { }) .catch((error) => { this.CoinAnimationStatus = this.$store.state.coinanimation - this.$toasted.global.error(error.message) + this.toastError(error.message) }) }, },