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
fec442ba51
commit
cb0edbd46e
@ -2,14 +2,17 @@ import { mount } from '@vue/test-utils'
|
||||
import UserCardFormUserData from './UserCard_FormUserData'
|
||||
import flushPromises from 'flush-promises'
|
||||
|
||||
import { toasters } from '../../../mixins/toaster'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
const mockAPIcall = jest.fn()
|
||||
|
||||
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_FormUserData', () => {
|
||||
let wrapper
|
||||
|
||||
@ -22,12 +25,6 @@ describe('UserCard_FormUserData', () => {
|
||||
},
|
||||
commit: storeCommitMock,
|
||||
},
|
||||
$toasted: {
|
||||
success: toastSuccessMock,
|
||||
global: {
|
||||
error: toastErrorMock,
|
||||
},
|
||||
},
|
||||
$apollo: {
|
||||
mutate: mockAPIcall,
|
||||
},
|
||||
@ -126,7 +123,7 @@ describe('UserCard_FormUserData', () => {
|
||||
})
|
||||
|
||||
it('toasts a success message', () => {
|
||||
expect(toastSuccessMock).toBeCalledWith('settings.name.change-success')
|
||||
expect(toastSuccessSpy).toBeCalledWith('settings.name.change-success')
|
||||
})
|
||||
|
||||
it('has an edit button again', () => {
|
||||
@ -159,7 +156,7 @@ describe('UserCard_FormUserData', () => {
|
||||
})
|
||||
|
||||
it('toasts an error message', () => {
|
||||
expect(toastErrorMock).toBeCalledWith('Error')
|
||||
expect(toastErrorSpy).toBeCalledWith('Error')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -108,10 +108,10 @@ export default {
|
||||
this.$store.commit('firstName', this.form.firstName)
|
||||
this.$store.commit('lastName', this.form.lastName)
|
||||
this.showUserData = true
|
||||
this.$toasted.success(this.$t('settings.name.change-success'))
|
||||
this.toastSuccess(this.$t('settings.name.change-success'))
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$toasted.global.error(error.message)
|
||||
this.toastError(error.message)
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user