Code coverage policy gui editor apex

Issue-ID: POLICY-3351
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
Change-Id: I019521b7343206404ce7bd1fa3a05f5ff782baa0
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js
index a1aed28..8bc3ed0 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2020-2021 Nordix Foundation
+ *  Copyright (C) 2020-2022 Nordix Foundation
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -132,4 +132,13 @@
    const mock_activate = jest.fn(mod.editContextAlbumForm_generateDescriptionPressed);
    mock_activate();
    expect(mock_activate).toBeCalled();
-});
\ No newline at end of file
+});
+
+test('Test editContextAlbumForm_cancelPressed', () => {
+   jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValue(null);
+   jest.spyOn(document, 'getElementById').mockReturnValue(null);
+   jest.spyOn(contextAlbumTab_reset, 'contextAlbumTab_reset').mockReturnValue(null);
+   const mock_activate = jest.fn(mod.editContextAlbumForm_cancelPressed);
+   mock_activate();
+   expect(mock_activate).toBeCalled();
+});
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 @@
    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 @@
    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 @@
    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();
+});
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTaskEditForm.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTaskEditForm.test.js
index f7ac592..b9982f5 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTaskEditForm.test.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTaskEditForm.test.js
@@ -161,3 +161,19 @@
    mock_activate();
    expect(mock_activate).toBeCalled();
 });
+
+test('Test editTaskForm_submitPressed', () => {
+   jest.spyOn(apexTaskTab, 'taskTab_reset').mockReturnValueOnce(null);
+   jest.spyOn(keyInformationTab_reset, 'keyInformationTab_reset').mockReturnValueOnce(null);
+   jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null);
+
+   let documentSpy = jest.spyOn(document, 'getElementById');
+   let elementMock = document.createElement("editTaskForm");
+   elementMock.setAttribute("createEditOrView", "CREATE");
+   elementMock.value = 'logictype'
+   documentSpy.mockReturnValue(elementMock);
+
+   const mock_activate = jest.fn(mod.editTaskForm_submitPressed);
+   mock_activate();
+   expect(mock_activate).toBeCalled();
+});
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexUtils.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexUtils.test.js
index bc331b6..ba4a536 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexUtils.test.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexUtils.test.js
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2021 Nordix Foundation
+ *  Copyright (C) 2021-2022 Nordix Foundation
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -96,3 +96,21 @@
     const actual = ApexUtils.createAddFormButton('My_text');
     expect(actual).toEqual(expected);
 });
+
+test('test EMPTY createEditArea', () => {
+    const mock_activate = jest.fn(ApexUtils.createEditArea);
+    mock_activate('id', null, '');
+    expect(mock_activate).toBeCalled();
+});
+
+test('test getHomepageURL', () => {
+    const mock_activate = jest.fn(ApexUtils.getHomepageURL);
+    mock_activate();
+    expect(mock_activate).toBeCalled();
+});
+
+test('test isFirefox', () => {
+    const mock_activate = jest.fn(ApexUtils.isFirefox);
+    mock_activate();
+    expect(mock_activate).toBeCalled();
+});
\ No newline at end of file