mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
change to bv toast
This commit is contained in:
parent
dd5aa62e58
commit
72c5940e84
@ -2,15 +2,18 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
|
|||||||
import ResetPassword from './ResetPassword'
|
import ResetPassword from './ResetPassword'
|
||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
|
|
||||||
|
import { toasters } from '../../mixins/toaster'
|
||||||
|
|
||||||
// validation is tested in src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js
|
// validation is tested in src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
const apolloMutationMock = jest.fn()
|
const apolloMutationMock = jest.fn()
|
||||||
|
|
||||||
const toasterMock = jest.fn()
|
|
||||||
const routerPushMock = jest.fn()
|
const routerPushMock = jest.fn()
|
||||||
|
|
||||||
|
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
||||||
|
|
||||||
const stubs = {
|
const stubs = {
|
||||||
RouterLink: RouterLinkStub,
|
RouterLink: RouterLinkStub,
|
||||||
}
|
}
|
||||||
@ -29,11 +32,6 @@ const mocks = {
|
|||||||
includes: jest.fn((t) => t === mocks.$route.path.mock),
|
includes: jest.fn((t) => t === mocks.$route.path.mock),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
$toasted: {
|
|
||||||
global: {
|
|
||||||
error: toasterMock,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
$router: {
|
$router: {
|
||||||
push: routerPushMock,
|
push: routerPushMock,
|
||||||
},
|
},
|
||||||
@ -65,7 +63,7 @@ describe('ResetPassword', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it.skip('toasts an error when no valid optin is given', () => {
|
it.skip('toasts an error when no valid optin is given', () => {
|
||||||
expect(toasterMock).toHaveBeenCalledWith('error')
|
expect(toastErrorSpy).toHaveBeenCalledWith('error')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('has a message suggesting to contact the support', () => {
|
it.skip('has a message suggesting to contact the support', () => {
|
||||||
@ -157,7 +155,7 @@ describe('ResetPassword', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('toasts an error message', () => {
|
it('toasts an error message', () => {
|
||||||
expect(toasterMock).toHaveBeenCalledWith('...Code is older than 10 minutes')
|
expect(toastErrorSpy).toHaveBeenCalledWith('...Code is older than 10 minutes')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('router pushes to /password/reset', () => {
|
it('router pushes to /password/reset', () => {
|
||||||
@ -174,7 +172,7 @@ describe('ResetPassword', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('toasts an error message', () => {
|
it('toasts an error message', () => {
|
||||||
expect(toasterMock).toHaveBeenCalledWith('Error')
|
expect(toastErrorSpy).toHaveBeenCalledWith('Error')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -99,7 +99,7 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$toasted.global.error(error.message)
|
this.toastError(error.message)
|
||||||
if (error.message.includes('Code is older than 10 minutes'))
|
if (error.message.includes('Code is older than 10 minutes'))
|
||||||
this.$router.push('/password/reset')
|
this.$router.push('/password/reset')
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user