2 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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
13 * or implied. See the License for the specific language governing
14 * permissions and limitations under the License.
17 import React from 'react';
18 import TestUtils from 'react-addons-test-utils';
19 import {VSPAttachmentTreeNodeWithChildrenFactory, VSPAttachmentDetailedError} from 'test-utils/factories/softwareProduct/SoftwareProductAttachmentsFactories.js';
20 import {defaultStoreFactory} from 'test-utils/factories/onboard/OnboardingCatalogFactories.js';
22 import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js';
23 import SoftwareProductAttachmentsView from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx';
24 import {tabsMapping} from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js';
25 import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js';
27 describe('SoftwareProduct Attachments - View: ', function () {
28 it('should mapper exist', () => {
29 expect(mapStateToProps).toBeTruthy();
32 it('should mapper return default data', () => {
34 let attachmentsTree = VSPAttachmentTreeNodeWithChildrenFactory.build();
35 let errorList = VSPAttachmentDetailedError.buildList(3);
36 let versionControllerData = VersionControllerUtilsFactory.build();
38 let softwareProductAttachments = {
39 attachmentsDetails: {activeTab: tabsMapping.SETUP},
47 let data = defaultStoreFactory.build({softwareProduct: {softwareProductAttachments, softwareProductEditor: {data: {...versionControllerData}}}});
48 var result = mapStateToProps(data);
49 expect(result).toBeTruthy();
50 expect(result.isValidationAvailable).toBe(false);
53 it('view test', () => {
55 let attachmentsTree = VSPAttachmentTreeNodeWithChildrenFactory.build();
56 let errorList = VSPAttachmentDetailedError.buildList(3);
57 let versionControllerData = VersionControllerUtilsFactory.build();
59 let softwareProductAttachments = {
60 attachmentsDetails: {},
66 shouldOpenValidationTab: false
68 let data = defaultStoreFactory.build({softwareProduct: {softwareProductAttachments, softwareProductEditor: {data: {...versionControllerData}}}});
69 var params = mapStateToProps(data);
71 var renderer = TestUtils.createRenderer();
72 renderer.render(<SoftwareProductAttachmentsView {...params}/>);
73 var renderedOutput = renderer.getRenderOutput();
74 expect(renderedOutput).toBeTruthy();