Changed the expected values to the one returned from apollo.

This commit is contained in:
Hannes Heine 2021-08-10 16:36:39 +02:00
parent 2566e7891a
commit 6996856fa3

View File

@ -157,6 +157,11 @@ describe('UserCardFormUserPasswort', () => {
describe('submit', () => {
describe('valid data', () => {
beforeEach(async () => {
changePasswordProfileMock.mockResolvedValue({
data: {
updateUserData: 'success',
},
})
await form.findAll('input').at(0).setValue('1234')
await form.findAll('input').at(1).setValue('Aa123456')
await form.findAll('input').at(2).setValue('Aa123456')
@ -166,10 +171,14 @@ describe('UserCardFormUserPasswort', () => {
it('calls the API', () => {
expect(changePasswordProfileMock).toHaveBeenCalledWith(
1,
'user@example.org',
'1234',
'Aa123456',
expect.objectContaining({
variables: {
sessionId: 1,
email: 'user@example.org',
password: '1234',
newPassword: 'Aa123456',
},
}),
)
})
@ -184,9 +193,8 @@ describe('UserCardFormUserPasswort', () => {
describe('server response is error', () => {
beforeEach(async () => {
changePasswordProfileMock.mockReturnValue({
success: false,
result: { message: 'error' },
changePasswordProfileMock.mockRejectedValue({
message: 'error',
})
await form.findAll('input').at(0).setValue('1234')
await form.findAll('input').at(1).setValue('Aa123456')