List of Input Parameters for VSP: FE
[sdc.git] / openecomp-ui / test / softwareProduct / validationResults / SoftwareProductValidationResultsView.test.js
1 /*
2  * Copyright © 2019 Vodafone Group
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 import React from 'react';
18 import { mapStateToProps } from 'sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResults.js';
19 import SoftwareProductValidationResultsView from 'sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResultsView.jsx';
20 import { VSPTestResultsSuccessFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationResultsFactory.js';
21 import { VSPTestResultsFailureFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationResultsFactory.js';
22 import TestUtils from 'react-dom/test-utils';
23
24 describe('SoftwareProductValidationResults Mapper and View Classes', () => {
25     it('mapStateToProps mapper exists', () => {
26         expect(mapStateToProps).toBeTruthy();
27     });
28
29     it('mapStateToProps fail data test', () => {
30         const vspTestResults = VSPTestResultsFailureFactory.build();
31
32         var obj = {
33             softwareProduct: {
34                 softwareProductValidation: {
35                     vspTestResults: vspTestResults.vspTestResults
36                 }
37             }
38         };
39         var results = mapStateToProps(obj);
40         expect(results.softwareProductValidation.vspTestResults).toBeTruthy();
41     });
42
43     it('mapStateToProps success data test', () => {
44         const vspTestResults = VSPTestResultsSuccessFactory.build();
45
46         var obj = {
47             softwareProduct: {
48                 softwareProductValidation: {
49                     vspTestResults: vspTestResults.vspTestResults
50                 }
51             }
52         };
53         var results = mapStateToProps(obj);
54         expect(results.softwareProductValidation.vspTestResults).toBeTruthy();
55     });
56
57     it('SoftwareProductValidationResultsView test fail render test', () => {
58         const vspTestResults = VSPTestResultsFailureFactory.build();
59
60         const version = {
61             name: 1
62         };
63         const softwareProductId = '1234';
64         var obj = {
65             softwareProductId: softwareProductId,
66             version: version,
67             softwareProductValidation: {
68                 vspTestResults: vspTestResults.vspTestResults
69             }
70         };
71         let vspValidationResultsView = TestUtils.renderIntoDocument(
72             <SoftwareProductValidationResultsView {...obj} />
73         );
74         expect(vspValidationResultsView).toBeTruthy();
75     });
76
77     it('SoftwareProductValidationResultsView test success render test', () => {
78         const vspTestResults = VSPTestResultsSuccessFactory.build();
79
80         let version = {
81             name: 1
82         };
83         const softwareProductId = '1234';
84         var obj = {
85             softwareProductId: softwareProductId,
86             version: version,
87             softwareProductValidation: {
88                 vspTestResults: vspTestResults.vspTestResults
89             }
90         };
91         let vspValidationResultsView = TestUtils.renderIntoDocument(
92             <SoftwareProductValidationResultsView {...obj} />
93         );
94         expect(vspValidationResultsView).toBeTruthy();
95     });
96 });