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 5a3ee8cd6..28451e781 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.spec.js.old +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.spec.js.old @@ -3,6 +3,8 @@ import UserCardFormUsername from './UserCard_FormUsername' import flushPromises from 'flush-promises' import { extend } from 'vee-validate' +import { toasters } from '../../../mixins/toaster' + const localVue = global.localVue const mockAPIcall = jest.fn() @@ -14,10 +16,11 @@ extend('gddUsernameUnique', { }, }) -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_FormUsername', () => { let wrapper @@ -29,12 +32,6 @@ describe('UserCard_FormUsername', () => { }, commit: storeCommitMock, }, - $toasted: { - success: toastSuccessMock, - global: { - error: toastErrorMock, - }, - }, $apollo: { mutate: mockAPIcall, }, @@ -125,7 +122,7 @@ describe('UserCard_FormUsername', () => { }) it('toasts an success message', () => { - expect(toastSuccessMock).toBeCalledWith('settings.name.change-success') + expect(toastSuccessSpy).toBeCalledWith('settings.name.change-success') }) it('has no edit button anymore', () => { @@ -155,7 +152,7 @@ describe('UserCard_FormUsername', () => { }) it('toasts an error message', () => { - expect(toastErrorMock).toBeCalledWith('Ouch!') + expect(toastErrorSpy).toBeCalledWith('Ouch!') }) it('renders an empty username', () => { diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue.old b/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue.old index 6bae1abb4..f54765be6 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue.old +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue.old @@ -97,10 +97,10 @@ export default { this.$store.commit('username', this.form.username) this.username = this.form.username this.showUsername = true - this.$toasted.success(this.$t('settings.name.change-success')) + this.toastSuccess(this.$t('settings.name.change-success')) }) .catch((error) => { - this.$toasted.global.error(error.message) + this.toastError(error.message) this.showUsername = true this.username = this.$store.state.username this.form.username = this.$store.state.username