mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
use bv toast
This commit is contained in:
parent
051446f526
commit
f67ac41389
@ -1,6 +1,8 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import UserCardLanguage from './UserCard_Language'
|
||||
|
||||
import { toasters } from '../../../mixins/toaster'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
const mockAPIcall = jest.fn().mockResolvedValue({
|
||||
@ -11,10 +13,11 @@ const mockAPIcall = jest.fn().mockResolvedValue({
|
||||
},
|
||||
})
|
||||
|
||||
const toastErrorMock = jest.fn()
|
||||
const toastSuccessMock = jest.fn()
|
||||
const storeCommitMock = jest.fn()
|
||||
|
||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
||||
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
|
||||
|
||||
describe('UserCard_Language', () => {
|
||||
let wrapper
|
||||
|
||||
@ -26,12 +29,6 @@ describe('UserCard_Language', () => {
|
||||
},
|
||||
commit: storeCommitMock,
|
||||
},
|
||||
$toasted: {
|
||||
success: toastSuccessMock,
|
||||
global: {
|
||||
error: toastErrorMock,
|
||||
},
|
||||
},
|
||||
$apollo: {
|
||||
mutate: mockAPIcall,
|
||||
},
|
||||
@ -143,7 +140,7 @@ describe('UserCard_Language', () => {
|
||||
})
|
||||
|
||||
it('toasts a success message', () => {
|
||||
expect(toastSuccessMock).toBeCalledWith('settings.language.success')
|
||||
expect(toastSuccessSpy).toBeCalledWith('settings.language.success')
|
||||
})
|
||||
})
|
||||
|
||||
@ -159,7 +156,7 @@ describe('UserCard_Language', () => {
|
||||
})
|
||||
|
||||
it('toasts an error message', () => {
|
||||
expect(toastErrorMock).toBeCalledWith('Ouch!')
|
||||
expect(toastErrorSpy).toBeCalledWith('Ouch!')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -97,11 +97,11 @@ export default {
|
||||
.then(() => {
|
||||
this.$store.commit('language', this.language)
|
||||
this.cancelEdit()
|
||||
this.$toasted.success(this.$t('settings.language.success'))
|
||||
this.toastSuccess(this.$t('settings.language.success'))
|
||||
})
|
||||
.catch((error) => {
|
||||
this.language = this.$store.state.language
|
||||
this.$toasted.global.error(error.message)
|
||||
this.toastError(error.message)
|
||||
})
|
||||
},
|
||||
buildTagFromLanguageString() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user