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
cb0edbd46e
commit
051446f526
@ -2,25 +2,21 @@ import { mount } from '@vue/test-utils'
|
||||
import UserCardFormPasswort from './UserCard_FormUserPasswort'
|
||||
import flushPromises from 'flush-promises'
|
||||
|
||||
import { toasters } from '../../../mixins/toaster'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
const changePasswordProfileMock = jest.fn()
|
||||
changePasswordProfileMock.mockReturnValue({ success: true })
|
||||
|
||||
const toastSuccessMock = jest.fn()
|
||||
const toastErrorMock = jest.fn()
|
||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
||||
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
|
||||
|
||||
describe('UserCard_FormUserPasswort', () => {
|
||||
let wrapper
|
||||
|
||||
const mocks = {
|
||||
$t: jest.fn((t) => t),
|
||||
$toasted: {
|
||||
success: toastSuccessMock,
|
||||
global: {
|
||||
error: toastErrorMock,
|
||||
},
|
||||
},
|
||||
$apollo: {
|
||||
mutate: changePasswordProfileMock,
|
||||
},
|
||||
@ -196,7 +192,7 @@ describe('UserCard_FormUserPasswort', () => {
|
||||
})
|
||||
|
||||
it('toasts a success message', () => {
|
||||
expect(toastSuccessMock).toBeCalledWith('site.thx.reset')
|
||||
expect(toastSuccessSpy).toBeCalledWith('site.thx.reset')
|
||||
})
|
||||
|
||||
it('cancels the edit process', () => {
|
||||
@ -217,7 +213,7 @@ describe('UserCard_FormUserPasswort', () => {
|
||||
})
|
||||
|
||||
it('toasts an error message', () => {
|
||||
expect(toastErrorMock).toBeCalledWith('error')
|
||||
expect(toastErrorSpy).toBeCalledWith('error')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -89,11 +89,11 @@ export default {
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
this.$toasted.success(this.$t('site.thx.reset'))
|
||||
this.toastSuccess(this.$t('site.thx.reset'))
|
||||
this.cancelEdit()
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$toasted.global.error(error.message)
|
||||
this.toastError(error.message)
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user