mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Changed the expected values that are given from the apollo call.
This commit is contained in:
parent
464d05efa0
commit
0765b80144
@ -98,6 +98,9 @@ describe('UserCard_FormUsername', () => {
|
||||
|
||||
describe('successfull submit', () => {
|
||||
beforeEach(async () => {
|
||||
mockAPIcall.mockResolvedValue({
|
||||
state: 'success',
|
||||
})
|
||||
jest.clearAllMocks()
|
||||
await wrapper.findAll('input').at(0).setValue('Petra')
|
||||
await wrapper.findAll('input').at(1).setValue('Lustiger')
|
||||
@ -108,11 +111,17 @@ describe('UserCard_FormUsername', () => {
|
||||
})
|
||||
|
||||
it('calls the loginAPI', () => {
|
||||
expect(mockAPIcall).toBeCalledWith(1, 'user@example.org', {
|
||||
firstName: 'Petra',
|
||||
lastName: 'Lustiger',
|
||||
description: 'Keine Nickelbrille',
|
||||
})
|
||||
expect(mockAPIcall).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: {
|
||||
sessionId: 1,
|
||||
email: 'user@example.org',
|
||||
firstName: 'Petra',
|
||||
lastName: 'Lustiger',
|
||||
description: 'Keine Nickelbrille',
|
||||
},
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('commits firstname to store', () => {
|
||||
@ -138,8 +147,10 @@ describe('UserCard_FormUsername', () => {
|
||||
|
||||
describe('submit results in server error', () => {
|
||||
beforeEach(async () => {
|
||||
mockAPIcall.mockRejectedValue({
|
||||
message: 'Error',
|
||||
})
|
||||
jest.clearAllMocks()
|
||||
mockAPIcall.mockReturnValue({ success: false, result: { message: 'Error' } })
|
||||
await wrapper.findAll('input').at(0).setValue('Petra')
|
||||
await wrapper.findAll('input').at(1).setValue('Lustiger')
|
||||
await wrapper.find('textarea').setValue('Keine Nickelbrille')
|
||||
@ -149,11 +160,17 @@ describe('UserCard_FormUsername', () => {
|
||||
})
|
||||
|
||||
it('calls the loginAPI', () => {
|
||||
expect(mockAPIcall).toBeCalledWith(1, 'user@example.org', {
|
||||
firstName: 'Petra',
|
||||
lastName: 'Lustiger',
|
||||
description: 'Keine Nickelbrille',
|
||||
})
|
||||
expect(mockAPIcall).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: {
|
||||
sessionId: 1,
|
||||
email: 'user@example.org',
|
||||
firstName: 'Petra',
|
||||
lastName: 'Lustiger',
|
||||
description: 'Keine Nickelbrille',
|
||||
},
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('toasts an error message', () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user