2 * Copyright © 2019 Vodafone Group
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
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 { VSPTestsMapFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
24 import TestUtils from 'react-dom/test-utils';
26 describe('SoftwareProductValidationResults Mapper and View Classes', () => {
27 it('mapStateToProps mapper exists', () => {
28 expect(mapStateToProps).toBeTruthy();
31 it('mapStateToProps fail data test', () => {
32 const vspTestResults = VSPTestResultsFailureFactory.build();
33 const vspTestsMap = VSPTestsMapFactory.build();
37 softwareProductValidation: {
38 vspTestResults: vspTestResults.vspTestResults,
39 vspTestsMap: vspTestsMap.vspTestsMap
43 var results = mapStateToProps(obj);
44 expect(results.softwareProductValidation.vspTestResults).toBeTruthy();
47 it('mapStateToProps success data test', () => {
48 const vspTestResults = VSPTestResultsSuccessFactory.build();
49 const vspTestsMap = VSPTestsMapFactory.build();
53 softwareProductValidation: {
54 vspTestResults: vspTestResults.vspTestResults,
55 vspTestsMap: vspTestsMap.vspTestsMap
59 var results = mapStateToProps(obj);
60 expect(results.softwareProductValidation.vspTestResults).toBeTruthy();
63 it('SoftwareProductValidationResultsView test fail render test', () => {
64 const vspTestResults = VSPTestResultsFailureFactory.build();
65 const vspTestsMap = VSPTestsMapFactory.build();
70 const softwareProductId = '1234';
72 softwareProductId: softwareProductId,
74 softwareProductValidation: {
75 vspTestResults: vspTestResults.vspTestResults,
76 vspTestsMap: vspTestsMap.vspTestsMap
79 let vspValidationResultsView = TestUtils.renderIntoDocument(
80 <SoftwareProductValidationResultsView {...obj} />
82 expect(vspValidationResultsView).toBeTruthy();
85 it('SoftwareProductValidationResultsView test success render test', () => {
86 const vspTestResults = VSPTestResultsSuccessFactory.build();
87 const vspTestsMap = VSPTestsMapFactory.build();
92 const softwareProductId = '1234';
94 softwareProductId: softwareProductId,
96 softwareProductValidation: {
97 vspTestResults: vspTestResults.vspTestResults,
98 vspTestsMap: vspTestsMap.vspTestsMap
101 let vspValidationResultsView = TestUtils.renderIntoDocument(
102 <SoftwareProductValidationResultsView {...obj} />
104 expect(vspValidationResultsView).toBeTruthy();