aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml
blob: a186d6ddb336f07378da4265841f83de8430e064 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <name>openecomp-sdc-translator-lib</name>
    <artifactId>openecomp-sdc-translator-lib</artifactId>
    <packaging>pom</packaging>

    <parent>
        <artifactId>openecomp-sdc-lib</artifactId>
        <groupId>org.openecomp.sdc</groupId>
        <version>1.6.0-SNAPSHOT</version>
    </parent>

    <modules>
        <module>openecomp-sdc-translator-api</module>
        <module>openecomp-sdc-translator-core</module>
    </modules>

    <dependencies>
    </dependencies>
</project>
/* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright © 2019 Vodafone Group
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import deepFreeze from 'deep-freeze';
import mockRest from 'test-utils/MockRest.js';
import { cloneAndSet } from 'test-utils/Util.js';
import { storeCreator } from 'sdc-app/AppStore.js';
import SoftwareProductValidationResultsViewActionHelper from 'sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResultsViewActionHelper.js';
import { tabsMapping } from 'sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidationConstants.js';
import Configuration from 'sdc-app/config/Configuration.js';
import { VSPTestResultsSuccessFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationResultsFactory.js';
import { VSPTestResultsFailureFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationResultsFactory.js';
import { VSPTestResultKeysFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationResultsFactory.js';
import { VSPTestsMapFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
import { VSPChecksFactory } 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 VersionFactory from 'test-utils/factories/common/VersionFactory.js';


describe('Software Product Validation Test Result Action Helper Tests', function() {
    const store = storeCreator();
    deepFreeze(store.getState());
    const version = VersionFactory.build();
    const vspId = 10000;
    const vspChecksList = VSPChecksFactory.build();
    const vspTestsMap = VSPTestsMapFactory.build();

    const errorMessage = { msg: 'Test Error Message' };
    const testsRequest = VSPTestsRequestFactory.build();
    const generalInfo = VSPGeneralInfoFactory.build();
    const isValidationDisabled = false;
    const testResultKeys = VSPTestResultKeysFactory.build();
    const vspTestResults = VSPTestResultsSuccessFactory.build();
    const requestQuery = "requestId="+testResultKeys.testResultKeys.requestId
        + "&" + "endPoint=" +  testResultKeys.testResultKeys.endPoints[0];
    let restPrefix = Configuration.get('restPrefix');
    let onClose = () => {};

    const modal = {
        type: 'error',
        title: 'Error',
        modalComponentName: 'Error',
        modalComponentProps: {
            onClose: onClose
        },
        msg: {
            msg: 'Test Error Message'
        },
        cancelButtonText: 'OK'
    };

    it('Software Products Validation Test Result Action Helper : fetch vsp', () => {
        let expectedStore = cloneAndSet(
            store.getState(),
            'softwareProduct.softwareProductValidationResult.vspChecks',
            vspChecksList
        );
        mockRest.addHandler('fetch', ({ baseUrl }) => {
            expect(baseUrl).toEqual(
                `${restPrefix}/v1.0/externaltesting/testcasetree`
            );
            return vspChecksList;
        });
        return SoftwareProductValidationResultsViewActionHelper.fetchVspChecks(
            store.dispatch
        ).then(() => {
            var stat  = store.getState();
            expect(stat).toEqual(expectedStore);
        })
    });

     it('Software Products Validation Test Result Action Helper : RefreshValidationResults', () => {
            let expectedStore = cloneAndSet(
                store.getState(),
                'softwareProduct.softwareProductValidationResult.vspTestResults',
                vspTestResults.vspTestResults
            );
            mockRest.addHandler('fetch', ({ baseUrl }) => {
                expect(baseUrl).toEqual(
                  `${restPrefix}/v1.0/externaltesting/executions?${requestQuery}`
                );
                return vspTestResults.vspTestResults;
            });
            return SoftwareProductValidationResultsViewActionHelper.refreshValidationResults(
                store.dispatch, {
                      requestId: testResultKeys.testResultKeys.requestId,
                      endPoints: testResultKeys.testResultKeys.endPoints
                }
            ).then(() => {
                var stt = store.getState();
                expect(stt).toEqual(expectedStore);
             })
     });
})