mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
change to bv toaster
This commit is contained in:
parent
b8edb67558
commit
dd5aa62e58
@ -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', () => {
|
||||
|
||||
@ -76,7 +76,7 @@ export default {
|
||||
)
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$toasted.global.error(error.message)
|
||||
this.toastError(error.message)
|
||||
})
|
||||
loader.hide()
|
||||
this.pending = false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user