svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2016-2017 European Support Limited |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 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 |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 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. |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | import React from 'react'; |
svishnev | aa2eece | 2018-01-18 17:52:06 +0200 | [diff] [blame] | 18 | import TestUtils from 'react-addons-test-utils'; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 19 | import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcesses.js'; |
| 20 | import SoftwareProductProcessesView from 'sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesView.jsx'; |
| 21 | |
| 22 | import {VSPProcessStoreFactory} from 'test-utils/factories/softwareProduct/SoftwareProductProcessFactories.js'; |
| 23 | import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js'; |
| 24 | import {VSPComponentsVersionControllerFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsNetworkFactories.js'; |
| 25 | |
| 26 | describe('SoftwareProductProcesses Mapper and View Classes', () => { |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 27 | it ('mapStateToProps mapper exists', () => { |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 28 | expect(mapStateToProps).toBeTruthy(); |
| 29 | }); |
| 30 | |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 31 | it ('mapStateToProps data test', () => { |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 32 | const currentSoftwareProduct = VSPEditorFactory.build(); |
| 33 | |
| 34 | const processesList = VSPProcessStoreFactory.buildList(2); |
| 35 | |
| 36 | var obj = { |
| 37 | softwareProduct: { |
| 38 | softwareProductEditor: { |
| 39 | data: currentSoftwareProduct |
| 40 | }, |
| 41 | softwareProductProcesses: |
| 42 | { |
| 43 | processesList, |
| 44 | processesEditor: {data: {}} |
| 45 | } |
| 46 | } |
| 47 | }; |
| 48 | var results = mapStateToProps(obj); |
| 49 | expect(results.processesList).toBeTruthy(); |
| 50 | }); |
| 51 | |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 52 | it ('view simple test', () => { |
| 53 | const currentSoftwareProduct = VSPEditorFactory.build(); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 54 | const processesList = VSPProcessStoreFactory.buildList(2); |
| 55 | |
| 56 | const versionControllerData = VSPComponentsVersionControllerFactory.build(); |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 57 | |
| 58 | |
svishnev | aa2eece | 2018-01-18 17:52:06 +0200 | [diff] [blame] | 59 | var renderer = TestUtils.createRenderer(); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 60 | renderer.render( |
| 61 | <SoftwareProductProcessesView |
| 62 | processesList={processesList} |
| 63 | versionControllerData={versionControllerData} |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 64 | currentSoftwareProduct={currentSoftwareProduct} |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 65 | onAddProcess={() => {}} |
| 66 | onEditProcess={() => {}} |
| 67 | onDeleteProcess={() => {}} |
| 68 | isDisplayEditor={false} |
| 69 | isReadOnlyMode={false} /> |
| 70 | ); |
| 71 | var renderedOutput = renderer.getRenderOutput(); |
| 72 | expect(renderedOutput).toBeTruthy(); |
| 73 | |
| 74 | }); |
| 75 | }); |