diff options
author | 2022-01-18 16:20:14 +0000 | |
---|---|---|
committer | 2022-01-18 18:54:19 +0000 | |
commit | 8849d1b8da31e25e2598def588a9b1fa96b5c111 (patch) | |
tree | 113c76ba801099910de67ed083eaa121b1727609 /gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js | |
parent | 1ef0fcce1314a8c3cccf207e271014bb2f1f4c22 (diff) |
Code coverage policy gui editor apex
Issue-ID: POLICY-3351
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
Change-Id: I019521b7343206404ce7bd1fa3a05f5ff782baa0
Diffstat (limited to 'gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js')
-rw-r--r-- | gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js index bcf21e5..48573e8 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js @@ -44,6 +44,8 @@ const contextSchema = { description: 'testDesc' } +const parentTBody = document.createElement('table'); + test('Test Activate', () => { const mock_activate = jest.fn(mod.editEventForm_activate); mock_activate(null, 'CREATE', null, contextSchema); @@ -138,6 +140,14 @@ test('Test Create Event', () => { expect(mock_activate).toBeCalled(); }); +test('Test editEventForm_addEventParam', () => { + let contextSchemas = new Array(); + contextSchemas.push(contextSchema); + const mock_activate = jest.fn(mod.editEventForm_addEventParam); + mock_activate(parentTBody, false, 'name', null, contextSchema, contextSchemas); + expect(mock_activate).toBeCalled(); +}); + test('Test Edit Event Generate UUID Pressed', () => { let documentSpy = jest.spyOn(document, 'getElementById'); let elementMock = document.createElement("editContextSchemaFormDescriptionTextArea"); @@ -156,3 +166,28 @@ test('Test Edit Event Generate Description Pressed', () => { mock_activate(); expect(mock_activate).toBeCalled(); }); +test('Test editEventForm_cancelPressed', () => { + jest.spyOn(keyInformationTab_reset, 'keyInformationTab_reset').mockReturnValueOnce(null); + jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null); + jest.spyOn(eventTab_reset, 'eventTab_reset').mockReturnValueOnce(null); + const mock_activate = jest.fn(mod.editEventForm_cancelPressed); + mock_activate(); + expect(mock_activate).toBeCalled(); +}); + +test('Test editTaskForm_submitPressed', () => { + jest.spyOn(keyInformationTab_reset, 'keyInformationTab_reset').mockReturnValueOnce(null); + jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null); + jest.spyOn(eventTab_reset, 'eventTab_reset').mockReturnValueOnce(null); + + let documentSpy = jest.spyOn(document, 'getElementById'); + let elementMock = document.createElement("editEventForm"); + elementMock.setAttribute("createEditOrView", "CREATE"); + elementMock.value = 'name_version' + elementMock.rows = 2 + documentSpy.mockReturnValue(elementMock); + + const mock_activate = jest.fn(mod.editEventForm_submitPressed); + mock_activate(); + expect(mock_activate).toBeCalled(); +}); |