diff --git a/frontend/src/views/Pages/RegisterSelectCommunity.spec.js b/frontend/src/views/Pages/RegisterSelectCommunity.spec.js index f4e980cd0..540f448cb 100644 --- a/frontend/src/views/Pages/RegisterSelectCommunity.spec.js +++ b/frontend/src/views/Pages/RegisterSelectCommunity.spec.js @@ -2,6 +2,8 @@ import { mount, RouterLinkStub } from '@vue/test-utils' import { communities, communityInfo } from '../../graphql/queries' import RegisterSelectCommunity from './RegisterSelectCommunity' +import { toasters } from '../../mixins/toaster' + const localVue = global.localVue const spinnerHideMock = jest.fn() @@ -12,6 +14,8 @@ const spinnerMock = jest.fn(() => { } }) +const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') + const apolloQueryMock = jest .fn() .mockResolvedValueOnce({ @@ -52,7 +56,6 @@ const apolloQueryMock = jest }, }) -const toasterMock = jest.fn() const mockStoreCommit = jest.fn() describe('RegisterSelectCommunity', () => { @@ -78,11 +81,6 @@ describe('RegisterSelectCommunity', () => { $loading: { show: spinnerMock, }, - $toasted: { - global: { - error: toasterMock, - }, - }, } const stubs = { @@ -129,7 +127,7 @@ describe('RegisterSelectCommunity', () => { }) it('toasts an error message', () => { - expect(toasterMock).toBeCalledWith('Failed to get communities') + expect(toastErrorSpy).toBeCalledWith('Failed to get communities') }) }) @@ -208,7 +206,7 @@ describe('RegisterSelectCommunity', () => { }) it('toast an error', () => { - expect(toasterMock).toBeCalledWith('Wrong thing') + expect(toastErrorSpy).toBeCalledWith('Wrong thing') }) it('hides the spinner', () => { diff --git a/frontend/src/views/Pages/RegisterSelectCommunity.vue b/frontend/src/views/Pages/RegisterSelectCommunity.vue index ab46da03f..28b89e95f 100644 --- a/frontend/src/views/Pages/RegisterSelectCommunity.vue +++ b/frontend/src/views/Pages/RegisterSelectCommunity.vue @@ -76,7 +76,7 @@ export default { ) }) .catch((error) => { - this.$toasted.global.error(error.message) + this.toastError(error.message) }) loader.hide() this.pending = false