mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Fix Test Confirm Register Email
This commit is contained in:
parent
d2e017f7a9
commit
0851a7bc35
@ -4,6 +4,8 @@ import ConfirmRegisterMailFormular from './ConfirmRegisterMailFormular.vue'
|
||||
const localVue = global.localVue
|
||||
|
||||
const apolloMutateMock = jest.fn().mockResolvedValue()
|
||||
const toastSuccessMock = jest.fn()
|
||||
const toastErrorMock = jest.fn()
|
||||
|
||||
const mocks = {
|
||||
$moment: jest.fn(() => {
|
||||
@ -19,6 +21,10 @@ const mocks = {
|
||||
$apollo: {
|
||||
mutate: apolloMutateMock,
|
||||
},
|
||||
$toasted: {
|
||||
success: toastSuccessMock,
|
||||
error: toastErrorMock,
|
||||
},
|
||||
}
|
||||
|
||||
const propsData = {
|
||||
@ -47,8 +53,18 @@ describe('ConfirmRegisterMailFormular', () => {
|
||||
wrapper.find('button.test-button').trigger('click')
|
||||
})
|
||||
|
||||
it('calls the API', () => {
|
||||
expect(apolloMutateMock).toBeCalled()
|
||||
it('calls the API with email', () => {
|
||||
expect(apolloMutateMock).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: { email: 'bob@baumeister.de' },
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('toasts a success message', () => {
|
||||
expect(toastSuccessMock).toBeCalledWith(
|
||||
'Erfolgreich senden der Confirmation Link an die E-Mail des Users! bob@baumeister.de',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@ -59,8 +75,10 @@ describe('ConfirmRegisterMailFormular', () => {
|
||||
wrapper.find('button.test-button').trigger('click')
|
||||
})
|
||||
|
||||
it('calls the API', () => {
|
||||
expect(apolloMutateMock).toBeCalled()
|
||||
it('toasts an error message', () => {
|
||||
expect(toastErrorMock).toBeCalledWith(
|
||||
'Fehler beim senden des confirmation link an den Benutzer: OUCH!',
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -42,13 +42,13 @@ export default {
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
this.$toasted.global.success(
|
||||
'Erfolgreich senden der Confirmation Link an die E-Mail des Users!' + this.email,
|
||||
this.$toasted.success(
|
||||
'Erfolgreich senden der Confirmation Link an die E-Mail des Users! ' + this.email,
|
||||
)
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$toasted.global.error(
|
||||
'Fehler beim senden des confirmation link an den Benutzer' + error,
|
||||
this.$toasted.error(
|
||||
'Fehler beim senden des confirmation link an den Benutzer: ' + error.message,
|
||||
)
|
||||
})
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user