From bb4a237f18c4b47448676d1d292e7da44eb0af32 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 3 Mar 2022 12:29:01 +0100 Subject: [PATCH] bv toast in deleted user formular --- admin/src/components/DeletedUserFormular.spec.js | 16 +++++----------- admin/src/components/DeletedUserFormular.vue | 8 ++++---- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/admin/src/components/DeletedUserFormular.spec.js b/admin/src/components/DeletedUserFormular.spec.js index bad97c1d7..78ed5e43f 100644 --- a/admin/src/components/DeletedUserFormular.spec.js +++ b/admin/src/components/DeletedUserFormular.spec.js @@ -2,6 +2,7 @@ import { mount } from '@vue/test-utils' import DeletedUserFormular from './DeletedUserFormular.vue' import { deleteUser } from '../graphql/deleteUser' import { unDeleteUser } from '../graphql/unDeleteUser' +import { toastErrorSpy, toastSuccessSpy } from '../../test/testSetup' const localVue = global.localVue @@ -13,9 +14,6 @@ const apolloMutateMock = jest.fn().mockResolvedValue({ }, }) -const toastedErrorMock = jest.fn() -const toastedSuccessMock = jest.fn() - const mocks = { $t: jest.fn((t) => t), $apollo: { @@ -29,10 +27,6 @@ const mocks = { }, }, }, - $toasted: { - error: toastedErrorMock, - success: toastedSuccessMock, - }, } const propsData = { @@ -119,7 +113,7 @@ describe('DeletedUserFormular', () => { }) it('toasts a success message', () => { - expect(toastedSuccessMock).toBeCalledWith('user_deleted') + expect(toastSuccessSpy).toBeCalledWith('user_deleted') }) it('emits update deleted At', () => { @@ -147,7 +141,7 @@ describe('DeletedUserFormular', () => { }) it('toasts an error message', () => { - expect(toastedErrorMock).toBeCalledWith('Oh no!') + expect(toastErrorSpy).toBeCalledWith('Oh no!') }) }) @@ -216,7 +210,7 @@ describe('DeletedUserFormular', () => { }) it('toasts a success message', () => { - expect(toastedSuccessMock).toBeCalledWith('user_recovered') + expect(toastSuccessSpy).toBeCalledWith('user_recovered') }) it('emits update deleted At', () => { @@ -244,7 +238,7 @@ describe('DeletedUserFormular', () => { }) it('toasts an error message', () => { - expect(toastedErrorMock).toBeCalledWith('Oh no!') + expect(toastErrorSpy).toBeCalledWith('Oh no!') }) }) diff --git a/admin/src/components/DeletedUserFormular.vue b/admin/src/components/DeletedUserFormular.vue index b840fdb23..be9f280d9 100644 --- a/admin/src/components/DeletedUserFormular.vue +++ b/admin/src/components/DeletedUserFormular.vue @@ -45,7 +45,7 @@ export default { }, }) .then((result) => { - this.$toasted.success(this.$t('user_deleted')) + this.toastSuccess(this.$t('user_deleted')) this.$emit('updateDeletedAt', { userId: this.item.userId, deletedAt: result.data.deleteUser, @@ -53,7 +53,7 @@ export default { this.checked = false }) .catch((error) => { - this.$toasted.error(error.message) + this.toastError(error.message) }) }, unDeleteUser() { @@ -65,7 +65,7 @@ export default { }, }) .then((result) => { - this.$toasted.success(this.$t('user_recovered')) + this.toastSuccess(this.$t('user_recovered')) this.$emit('updateDeletedAt', { userId: this.item.userId, deletedAt: result.data.unDeleteUser, @@ -73,7 +73,7 @@ export default { this.checked = false }) .catch((error) => { - this.$toasted.error(error.message) + this.toastError(error.message) }) }, },