aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/test/softwareProduct/validation
diff options
context:
space:
mode:
authoratulpurohit <atul.purohit1@vodafone.com>2019-11-05 14:31:56 +0530
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-01-13 09:33:40 +0000
commit8b346842194edb8a9e8c4cd2764ae8ebbce988f0 (patch)
tree3ea20981d4cdd5858c4a99eb49c0370503c3c6cb /openecomp-ui/test/softwareProduct/validation
parent0ef638b2eb44c9f473e5ad8bea119845d968fde7 (diff)
Refresh option in validation result page
Issue-ID: SDC-2585 Co-authored-by: nikhil.soni@vodafone.com Signed-off-by: atulpurohit <atul.purohit1@vodafone.com> Change-Id: I78f1385d219837c300cb33aff82b7459f137babb Signed-off-by: atulpurohit <atul.purohit1@vodafone.com>
Diffstat (limited to 'openecomp-ui/test/softwareProduct/validation')
-rw-r--r--openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationActionHelper.test.js70
-rw-r--r--openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationInputView.test.js4
2 files changed, 52 insertions, 22 deletions
diff --git a/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationActionHelper.test.js b/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationActionHelper.test.js
index 0a8f640426..3be1d68bbc 100644
--- a/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationActionHelper.test.js
+++ b/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationActionHelper.test.js
@@ -24,12 +24,14 @@ import Configuration from 'sdc-app/config/Configuration.js';
import { VSPComplianceCheckedFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
import { VSPCertificationCheckedFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+import { VSPTestResultKeysFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationResultsFactory.js';
import { VSPChecksFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
import { VSPTestsMapFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
import { VSPTestsRequestFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
import { VSPGeneralInfoFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
import { VSPTestResultsSuccessFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationResultsFactory.js';
import { mapActionsToProps } from 'sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidation.js';
+import { VSPTestRequestFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
describe('Software Product Validation Action Helper Tests', function() {
const store = storeCreator();
@@ -45,8 +47,10 @@ describe('Software Product Validation Action Helper Tests', function() {
const generalInfo = VSPGeneralInfoFactory.build();
const isValidationDisabled = false;
const vspTestResults = VSPTestResultsSuccessFactory.build();
+ const testResultKeys = VSPTestResultKeysFactory.build();
let restPrefix = Configuration.get('restPrefix');
let onClose = () => {};
+ const vspTestRequest = VSPTestRequestFactory.build();
const modal = {
type: 'error',
@@ -91,28 +95,50 @@ describe('Software Product Validation Action Helper Tests', function() {
});
});
- // it('Software Products Validation Action Helper : post test', () => {
- // mockRest.addHandler('post', ({ options, data, baseUrl }) => {
- // expect(baseUrl).toEqual(
- // `${restPrefix}/v1.0/externaltesting/executions`
- // );
- // //expect(data).toEqual(testsRequest);
- // expect(options).toEqual(undefined);
- // return { vspTestResults: vspTestResults };
- // });
- // const version = {
- // id: 12345,
- // name: 1
- // };
- // const softwareProductId = '1234';
- // const status = 'draft';
- // mapActionsToProps(store.dispatch).onTestSubmit(
- // softwareProductId,
- // version,
- // status,
- // testsRequest
- // );
- // });
+ it('Software Products Validation Action Helper : post test', () => {
+
+ const str = storeCreator({
+ softwareProduct: {
+ softwareProductValidation: {
+ testResultKeys: testResultKeys.testResultKeys
+ }
+ }
+ });
+ deepFreeze(str.getState());
+ let expectedStore = cloneAndSet(
+ str.getState(),
+ 'softwareProduct.softwareProductValidation.vspTestResults',
+ vspTestResults.vspTestResults
+ );
+ const version = {
+ id: 12345,
+ name: 1
+ };
+ const requestId = "1"
+ const softwareProductId = '1234';
+ const status = 'success';
+ mockRest.addHandler('post', ({ options, data, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `${restPrefix}/v1.0/externaltesting/executions?vspId=${softwareProductId}&vspVersionId=${version.id}&requestId=${requestId}`
+ );
+ return vspTestResults.vspTestResults ;
+ });
+ SoftwareProductValidationActionHelper.navigateToSoftwareProductValidationResults(
+ str.dispatch,{
+ softwareProductId: softwareProductId,
+ version: version,
+ status: status,
+ tests :vspTestRequest.vspTestRequest,
+ requestId: requestId
+ }
+ ).then(() => {
+ expect(str.getState()).toEqual(expectedStore);
+ })
+ .catch((e) => {
+ console.log('Executions test returned Error');
+ });
+
+ });
it('Software Products Validation Action Helper : setCertificationChecked', () => {
let expectedStore = cloneAndSet(
diff --git a/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationInputView.test.js b/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationInputView.test.js
index 68a8cdd957..c66cf91df4 100644
--- a/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationInputView.test.js
+++ b/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationInputView.test.js
@@ -112,5 +112,9 @@ describe('SoftwareProductValidation Mapper and View Classes', () => {
);
expect(inputForm).toBeTruthy();
TestUtils.Simulate.submit(inputForm);
+ let result = TestUtils.scryRenderedDOMComponentsWithTag(vspValidationInputView, 'input');
+ expect(result).toBeTruthy();
+ expect(result.length).toBeTruthy();
+ TestUtils.Simulate.change(result[0]);
});
});