From 051446f526a7d8a2d62f5dae47d6bde4c184da42 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 16 Feb 2022 08:11:26 +0100 Subject: [PATCH] use bv toast --- .../UserCard_FormUserPasswort.spec.js | 16 ++++++---------- .../UserProfile/UserCard_FormUserPasswort.vue | 4 ++-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js index 1057f71f1..cf870f179 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js @@ -2,25 +2,21 @@ import { mount } from '@vue/test-utils' import UserCardFormPasswort from './UserCard_FormUserPasswort' import flushPromises from 'flush-promises' +import { toasters } from '../../../mixins/toaster' + const localVue = global.localVue const changePasswordProfileMock = jest.fn() changePasswordProfileMock.mockReturnValue({ success: true }) -const toastSuccessMock = jest.fn() -const toastErrorMock = jest.fn() +const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') +const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess') describe('UserCard_FormUserPasswort', () => { let wrapper const mocks = { $t: jest.fn((t) => t), - $toasted: { - success: toastSuccessMock, - global: { - error: toastErrorMock, - }, - }, $apollo: { mutate: changePasswordProfileMock, }, @@ -196,7 +192,7 @@ describe('UserCard_FormUserPasswort', () => { }) it('toasts a success message', () => { - expect(toastSuccessMock).toBeCalledWith('site.thx.reset') + expect(toastSuccessSpy).toBeCalledWith('site.thx.reset') }) it('cancels the edit process', () => { @@ -217,7 +213,7 @@ describe('UserCard_FormUserPasswort', () => { }) it('toasts an error message', () => { - expect(toastErrorMock).toBeCalledWith('error') + expect(toastErrorSpy).toBeCalledWith('error') }) }) }) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue index 5d63e9832..d1608d72e 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue @@ -89,11 +89,11 @@ export default { }, }) .then(() => { - this.$toasted.success(this.$t('site.thx.reset')) + this.toastSuccess(this.$t('site.thx.reset')) this.cancelEdit() }) .catch((error) => { - this.$toasted.global.error(error.message) + this.toastError(error.message) }) }, },