From 5aee9c3abec9709cc2958815e3d7d694a329dc6a Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 16 Feb 2022 07:53:03 +0100 Subject: [PATCH] adjust test to bv toast --- frontend/src/views/Pages/Register.spec.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/frontend/src/views/Pages/Register.spec.js b/frontend/src/views/Pages/Register.spec.js index 1a966e5b6..7065f4638 100644 --- a/frontend/src/views/Pages/Register.spec.js +++ b/frontend/src/views/Pages/Register.spec.js @@ -1,8 +1,9 @@ import { mount, RouterLinkStub } from '@vue/test-utils' import flushPromises from 'flush-promises' - import Register from './Register' +import { toasters } from '../../mixins/toaster' + const localVue = global.localVue const apolloQueryMock = jest.fn().mockResolvedValue({ @@ -16,11 +17,12 @@ const apolloQueryMock = jest.fn().mockResolvedValue({ }, }) -const toastErrorMock = jest.fn() const mockStoreCommit = jest.fn() const registerUserMutationMock = jest.fn() const routerPushMock = jest.fn() +const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') + describe('Register', () => { let wrapper @@ -48,11 +50,6 @@ describe('Register', () => { publisherId: 12345, }, }, - $toasted: { - global: { - error: toastErrorMock, - }, - }, } const stubs = { @@ -96,7 +93,7 @@ describe('Register', () => { }) it('toasts an error message', () => { - expect(toastErrorMock).toBeCalledWith('Failed to get communities') + expect(toastErrorSpy).toBeCalledWith('Failed to get communities') }) })