summaryrefslogtreecommitdiffstats
path: root/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.test.js
diff options
context:
space:
mode:
authorbrunomilitzer <bruno.militzer@est.tech>2022-01-27 17:51:58 +0000
committerbrunomilitzer <bruno.militzer@est.tech>2022-01-28 13:58:53 +0000
commitf8ec2dcdcec8a686d3e58d82a99aa097df2f0c41 (patch)
treedc981ad80437976d89662e01139cc26c6da463e4 /gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.test.js
parent9957cf988f2199d9d0ff3838e7f90e70d9cb6ae8 (diff)
Added Menu and Loop Jest Tests
Issue-ID: POLICY-3876 Change-Id: I5f4d80aefdff8b837a40742b66727b888e985b86 Signed-off-by: brunomilitzer <bruno.militzer@est.tech>
Diffstat (limited to 'gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.test.js')
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.test.js32
1 files changed, 22 insertions, 10 deletions
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.test.js b/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.test.js
index 79267af..ef57998 100644
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.test.js
@@ -2,8 +2,8 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
- * reserved.
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 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.
@@ -28,15 +28,18 @@ import LoopService from '../../../api/LoopService';
import PolicyToscaService from '../../../api/PolicyToscaService';
describe('Verify ModifyLoopModal', () => {
+ const toscaPolicyModels = [{
+ "policyModelType": "test",
+ "policyAcronym": "test",
+ "version": "1.0.0",
+ "updatedBy": "",
+ "updatedDate": ""
+ }];
+ const selectedPolicyModels = [];
+
beforeEach(() => {
PolicyToscaService.getToscaPolicyModels = jest.fn().mockImplementation(() => {
- return Promise.resolve([{
- "policyModelType": "test",
- "policyAcronym": "test",
- "version": "1.0.0",
- "updatedBy": "",
- "updatedDate": ""
- }]);
+ return Promise.resolve(toscaPolicyModels);
});
PolicyToscaService.getToscaPolicyModelYaml = jest.fn().mockImplementation(() => {
return Promise.resolve("OK");
@@ -62,7 +65,6 @@ describe('Verify ModifyLoopModal', () => {
}
});
const historyMock = { push: jest.fn() };
- const flushPromises = () => new Promise(setImmediate);
it('Test handleClose', () => {
const handleClose = jest.spyOn(ModifyLoopModal.prototype, 'handleClose');
@@ -106,4 +108,14 @@ describe('Verify ModifyLoopModal', () => {
instance.handleYamlContent(event);
expect(component.state('content')).toEqual("testValue");
});
+
+ it('Test initializeToscaPolicyModelsInfo', () => {
+ const component = mount(<ModifyLoopModal loopCache={ loopCache }/>)
+ component.setState({
+ toscaPolicyModelsData: toscaPolicyModels,
+ selectedPolicyModelsData: selectedPolicyModels
+ });
+ expect(component.state('toscaPolicyModelsData')).toEqual(toscaPolicyModels);
+ expect(component.state('selectedPolicyModelsData')).toEqual(selectedPolicyModels);
+ });
});