diff options
author | 2021-10-29 11:37:15 +0100 | |
---|---|---|
committer | 2021-10-29 14:03:35 +0100 | |
commit | 3b303846b3e6bc75ae713030fe9b973a156944fa (patch) | |
tree | c4100643f8687d4e855e9adf76e53d421ccf0951 /gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPolicyEditForm_State.test.js | |
parent | 5bd5e5a0e64afff9c285860f1f5069e6acc25d67 (diff) |
Improved Test Coverage in gui-editor-apex
Issue-ID: POLICY-3351
Change-Id: I6f039b4e1b856ddb73379c97c88b5a695f2c478c
Signed-off-by: Lathish <lathishbabu.ganesan@est.tech>
Diffstat (limited to 'gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPolicyEditForm_State.test.js')
-rw-r--r-- | gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPolicyEditForm_State.test.js | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPolicyEditForm_State.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPolicyEditForm_State.test.js index 1f1767a..8dd9fc4 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPolicyEditForm_State.test.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPolicyEditForm_State.test.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation + * Copyright (C) 2020-2021 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,6 +117,37 @@ test('Test editPolicyForm_State_addPolicyTask', () => { }); -test.todo('Test editPolicyForm_State_getDirectOutputMappingOptions'); -test.todo('Test editPolicyForm_State_getStateBean'); -test.todo('Test editPolicyForm_State_getLogicOutputMappingOptions');
\ No newline at end of file +test('Test editPolicyForm_State_getDirectOutputMappingOptions', () => { + let documentSpy = jest.spyOn(document, 'getElementById'); + let elementMock = document.createElement("editPolicyFormDirOutputsTable_stateName"); + elementMock.rows = '1' + documentSpy.mockReturnValue(elementMock); + const mock_activate = jest.fn(mod.editPolicyForm_State_getDirectOutputMappingOptions); + mock_activate('stateName'); + expect(mock_activate).toBeCalled(); + +}); + +test('Test editPolicyForm_State_getStateBean', () => { + let documentSpy = jest.spyOn(document, 'getElementById'); + let elementMock = document.createElement("editPolicyFormDirOutputsTable_stateName"); + elementMock.rows = '1' + documentSpy.mockReturnValue(elementMock); + const mock_activate = jest.fn(mod.editPolicyForm_State_getStateBean); + mock_activate('stateName'); + expect(mock_activate).toBeCalled(); + +}); + +test('Test editPolicyForm_State_getStateBean StateName is Null', () => { + const mock_activate = jest.fn(mod.editPolicyForm_State_getStateBean); + mock_activate(null); + expect(mock_activate).toBeCalled(); + +}); + +test('Test editPolicyForm_State_getLogicOutputMappingOptions', () => { + const mock_activate = jest.fn(mod.editPolicyForm_State_getLogicOutputMappingOptions); + mock_activate(null); + expect(mock_activate).toBeCalled(); +});
\ No newline at end of file |