blob: 0d8ce945c88f177dec4fc7513366eb670b8d5afb [file] [log] [blame]
AviZi280f8012017-06-09 02:39:56 +03001/*!
2 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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
13 * or implied. See the License for the specific language governing
14 * permissions and limitations under the License.
15 */
16
17import React from 'react';
18import TestUtils from 'react-addons-test-utils';
19import {mapStateToProps } from 'sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js';
20import LicenseModelCreationView from 'sdc-app/onboarding/licenseModel/creation/LicenseModelCreationView.jsx';
21import {LicenseModelCreationFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
22
23describe('License Model Creation Module Tests', function() {
24 it ('mapStateToProps mapper exists', () => {
25 expect(mapStateToProps).toBeTruthy();
26 });
27
28 it ('should return empty data', () => {
29 let state = {
30 licenseModelList: [],
31 licenseModel: {
32 licenseModelCreation: {
33 data: {}
34 }
35 }
36 };
37 let props = mapStateToProps(state);
38 expect(props.data).toEqual({});
39 });
40
41 it ('should return vlm names list', () => {
42 let state = {
43 licenseModelList: [{
44 vendorName: 'vlm1',
45 id: 'vlm1_id'
46 }, {
47 vendorName: 'vlm2',
48 id: 'vlm2_id'
49 }],
50 licenseModel: {
51 licenseModelCreation: {
52 data: {}
53 }
54 }
55 };
56 let props = mapStateToProps(state);
57 expect(props.data).toEqual({});
58 expect(props.VLMNames).toEqual({vlm1: 'vlm1_id', vlm2: 'vlm2_id'});
59 });
60
61 it('simple jsx test', () => {
62 let data = LicenseModelCreationFactory.build();
63 var renderer = TestUtils.createRenderer();
64 renderer.render(
65 <LicenseModelCreationView
66 data={data}
67 onDataChanged={() => {}}
68 onValidateForm={() => {}}
69 onSubmit={() => {}}
70 onCancel={() => {}}/>
71 );
72 var renderedOutput = renderer.getRenderOutput();
73 expect(renderedOutput).toBeTruthy();
74 });
75});