summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@est.tech>2022-02-26 10:47:46 +0000
committerGerrit Code Review <gerrit@onap.org>2022-02-26 10:47:46 +0000
commit4a4a638d6d0336134cdb4cdab093054f3b3f09f9 (patch)
treee573d0b400bed1ff50ec815da974b738ddf74c1b
parent4a50604b767176aa323acae366fa762015a7f9f6 (diff)
parent62bbf4d0aa4831f6bdd461011b71a4bb94724517 (diff)
Merge "Code coverage apex editor"
-rw-r--r--gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPolicyEditForm_State.test.js12
-rw-r--r--gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js21
-rw-r--r--gui-editors/gui-editor-apex/src/main/webapp/js/__test__/fileMenu.test.js7
3 files changed, 33 insertions, 7 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPolicyEditForm_State.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPolicyEditForm_State.test.js
index 8b73319..24df8d0 100644
--- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPolicyEditForm_State.test.js
+++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPolicyEditForm_State.test.js
@@ -62,14 +62,22 @@ const policy = {
version: 'testVersion',
uuid: 'testUUID'
},
- uuid: 'testUUID'
+ uuid: 'testUUID',
+ state: [{ key: 'testName1', value: '1'}, { key: 'testName2',value: '2'}]
}
const state = {
trigger: {
name: 'testName',
version: '0.0.1',
- }
+ },
+ defaultTask: {
+ name: 'deftestName',
+ version: '0.0.2',
+ },
+ taskReferences: [{key: { name: 'testName1',version: '1'}, key: { name: 'testName2',version: '2'}}],
+ stateOutputs : [{key: { name: 'testName1',version: '1'}, key: { name: 'testName2',version: '2'}}],
+ stateFinalizerLogicMap : [{key: {value: { logic: 'testName1', logicFlavour : '1'}}, key: {value: { logic: 'testName1', logicFlavour : '1'}}}]
}
const parentTBody = document.createElement('table');
diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js
index 5e2d2ae..fdc30d7 100644
--- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js
+++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js
@@ -37,7 +37,17 @@ const task = {
name: 'testName',
version: 'testVersion'
},
- uuid: 'testUUID'
+ uuid: 'testUUID',
+ description: 'Description of task',
+ taskLogic: {
+ logicFlavour: 'testFlav'
+ },
+ inputFields : {entry: [{key: "key1", value: {fieldSchemaKey: { name : "name2", version : "version2"}}}]},
+ outputFields : {entry: [{key: "key01", value: {fieldSchemaKey: { name : "name02", version : "version02"}}}]},
+ taskParameters: {entry: [{key: 'testKey',value: {defaultValue: 'testValue'}}]},
+ contextAlbumReference : [{name : 'contextEntry.name',version : 'contextEntry.version', displaytext : 'contextName'},
+ {name : 'contextEntry.name2',version : 'contextEntry.version2', displaytext : 'contextName2'},
+ {name : 'contextEntry.name3',version : 'contextEntry.version3', displaytext : 'contextName3'}]
};
let data = {
@@ -98,6 +108,9 @@ test('Test Edit Task Inner', () => {
$.ajax = jest.fn().mockImplementation((args) => {
args.success(data, null, jqXHR);
});
+ jest.spyOn(apexTaskTab, 'taskTab_reset').mockReturnValueOnce(null);
+ jest.spyOn(keyInformationTab_reset, 'keyInformationTab_reset').mockReturnValueOnce(null);
+ jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null);
const mock_activate = jest.fn(mod.editTaskForm_editTask_inner);
mock_activate('test', 'name', 'version', 'Edit');
expect(mock_activate).toBeCalled();
@@ -193,11 +206,13 @@ test('Test editTaskForm_submitPressed with page', () => {
'</table>' +
'</body></html>';
let documentSpy = jest.spyOn(document, 'getElementById');
- let elementMock = document.getElementById("editTaskFormInputFieldsTable");
+ let elementMock = document.createElement("editTaskFormInputFieldsTable");
elementMock.value = 'notNullValue';
- elementMock.selectedOption = {"name": "name1", "version": "version1"};
+ elementMock.selectedOption = {"name": "name1", "version": "version1", "displaytext": "t"};
elementMock.checked = {"name": "nameOpt", "version": "versionOpt"};
elementMock.setAttribute("createEditOrView", "EDIT")
+ elementMock.rows = document.getElementById("editTaskFormInputFieldsTable").rows;
+ console.log(elementMock.rows);
documentSpy.mockReturnValue(elementMock);
const mock_activate = jest.fn(mod.editTaskForm_submitPressed);
diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/fileMenu.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/fileMenu.test.js
index ffc9e2c..9f3c4b1 100644
--- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/fileMenu.test.js
+++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/fileMenu.test.js
@@ -21,11 +21,14 @@
const mod = require('../fileMenu');
test('test hideMenu', () => {
- document.documentElement.innerHTML = '<html><head></head><body><ul id="menu">Hello world!</ul></body></html>';
+ document.documentElement.innerHTML = '<html><head></head><body><ul id="menu">Hello world<li>!</li></ul></body></html>';
$ = require('jquery');
window.$ = $;
$('#menu').fileMenu();
- $('#menu').click();
+ $('li').mouseenter();
+ $('li').click();
+ $('ul').mouseenter();
+ $('ul').click();
let h1 = document.querySelector('ul');
expect(h1.textContent).toEqual('Hello world!');
});