diff --git a/admin/src/components/CreationFormular.spec.js b/admin/src/components/CreationFormular.spec.js index 1c7dd40fc..5b733f4e0 100644 --- a/admin/src/components/CreationFormular.spec.js +++ b/admin/src/components/CreationFormular.spec.js @@ -98,7 +98,10 @@ describe('CreationFormular', () => { describe('with mass creation', () => { beforeEach(async () => { jest.clearAllMocks() - await wrapper.setProps({ type: 'massCreation' }) + await wrapper.setProps({ type: 'massCreation', creation: [200, 400, 600] }) + await wrapper.setData({ rangeMin: 180 }) + await wrapper.setData({ text: 'Test create coins' }) + await wrapper.setData({ value: 90 }) }) describe('first radio button', () => { diff --git a/admin/src/components/EditCreationFormular.spec.js b/admin/src/components/EditCreationFormular.spec.js index b7b091e32..10aac7648 100644 --- a/admin/src/components/EditCreationFormular.spec.js +++ b/admin/src/components/EditCreationFormular.spec.js @@ -16,6 +16,7 @@ const apolloMutateMock = jest.fn().mockResolvedValue({ const stateCommitMock = jest.fn() const toastedErrorMock = jest.fn() +const toastedSuccessMock = jest.fn() const mocks = { $moment: jest.fn(() => { @@ -42,6 +43,7 @@ const mocks = { }, $toasted: { error: toastedErrorMock, + success: toastedSuccessMock, }, } @@ -52,6 +54,10 @@ const propsData = { amount: 100, date: '2021-12-01', }, + item: { + id: 0, + email: 'bob@baumeister.de', + }, } describe('EditCreationFormular', () => { @@ -108,8 +114,8 @@ describe('EditCreationFormular', () => { variables: { amount: 90, creationDate: 'YYYY-MM-01', - email: undefined, - id: undefined, + email: 'bob@baumeister.de', + id: 0, memo: 'Test create coins', moderator: 0, }, @@ -117,6 +123,25 @@ describe('EditCreationFormular', () => { ) }) + it('emits update-user-data', () => { + expect(wrapper.emitted('update-user-data')).toBeTruthy() + expect(wrapper.emitted('update-user-data')).toEqual([ + [ + { + id: 0, + email: 'bob@baumeister.de', + }, + [0, 0, 0], + ], + ]) + }) + + it('toast success message', () => { + expect(toastedSuccessMock).toBeCalledWith( + 'Offene schöpfung (90 GDD) für bob@baumeister.de wurde geändert, liegt zur Bestätigung bereit', + ) + }) + describe('sendForm with error', () => { beforeEach(async () => { jest.clearAllMocks() @@ -163,8 +188,8 @@ describe('EditCreationFormular', () => { variables: { amount: 90, creationDate: 'YYYY-MM-01', - email: undefined, - id: undefined, + email: 'bob@baumeister.de', + id: 0, memo: 'Test create coins', moderator: 0, }, @@ -219,8 +244,8 @@ describe('EditCreationFormular', () => { variables: { amount: 90, creationDate: 'YYYY-MM-DD', - email: undefined, - id: undefined, + email: 'bob@baumeister.de', + id: 0, memo: 'Test create coins', moderator: 0, },