2 * Copyright © 2016-2017 European Support Limited
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 ShallowRenderer from 'react-test-renderer/shallow';
19 import TestUtils from 'react-dom/test-utils';
20 import {VSPAttachmentTreeNodeWithChildrenFactory, VSPAttachmentDetailedError} from 'test-utils/factories/softwareProduct/SoftwareProductAttachmentsFactories.js';
21 import {defaultStoreFactory} from 'test-utils/factories/onboard/OnboardingCatalogFactories.js';
23 import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js';
24 import SoftwareProductAttachmentsView from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx';
25 import {tabsMapping} from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js';
26 import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js';
28 describe('SoftwareProduct Attachments - View: ', function () {
29 it('should mapper exist', () => {
30 expect(mapStateToProps).toBeTruthy();
33 it('should mapper return default data', () => {
35 let attachmentsTree = VSPAttachmentTreeNodeWithChildrenFactory.build();
36 let errorList = VSPAttachmentDetailedError.buildList(3);
37 let versionControllerData = VersionControllerUtilsFactory.build();
39 let softwareProductAttachments = {
40 attachmentsDetails: {activeTab: tabsMapping.SETUP},
48 let data = defaultStoreFactory.build({softwareProduct: {softwareProductAttachments, softwareProductEditor: {data: {...versionControllerData}}}});
49 var result = mapStateToProps(data);
50 expect(result).toBeTruthy();
51 expect(result.isValidationAvailable).toBe(false);
54 it('view test', () => {
56 let attachmentsTree = VSPAttachmentTreeNodeWithChildrenFactory.build();
57 let errorList = VSPAttachmentDetailedError.buildList(3);
58 let versionControllerData = VersionControllerUtilsFactory.build();
60 let softwareProductAttachments = {
61 attachmentsDetails: {},
67 shouldOpenValidationTab: false
69 let data = defaultStoreFactory.build({softwareProduct: {softwareProductAttachments, softwareProductEditor: {data: {...versionControllerData}}}});
70 var params = mapStateToProps(data);
72 const renderer = new ShallowRenderer();
73 renderer.render(<SoftwareProductAttachmentsView {...params}/>);
74 var renderedOutput = renderer.getRenderOutput();
75 expect(renderedOutput).toBeTruthy();