change to bv toaster

This commit is contained in:
Moriz Wahl 2022-02-16 07:58:11 +01:00
parent b8edb67558
commit dd5aa62e58
2 changed files with 7 additions and 9 deletions

View File

@ -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', () => {

View File

@ -76,7 +76,7 @@ export default {
)
})
.catch((error) => {
this.$toasted.global.error(error.message)
this.toastError(error.message)
})
loader.hide()
this.pending = false