Add unit tests for UI
[clamp.git] / ui-react / src / components / loop_viewer / status / LoopStatus.test.js
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  * ===================================================================
21  *
22  */
23 import React from 'react';
24 import { shallow } from 'enzyme';
25 import LoopStatus from './LoopStatus';
26 import LoopCache from '../../../api/LoopCache';
27
28 describe('Verify LoopStatus', () => {
29
30         const loopCache = new LoopCache({
31                 "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
32                 "lastComputedState": "DESIGN",
33                 "components": {
34                         "POLICY": {
35                                 "componentState": {
36                                         "stateName": "NOT_SENT",
37                                         "description": "The policies defined have NOT yet been created on the policy engine"
38                                 }
39                         },
40                         "DCAE": {
41                                 "componentState": {
42                                         "stateName": "BLUEPRINT_DEPLOYED",
43                                         "description": "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop"
44                                 }
45                         }
46                 }
47         });
48
49         it('Test the render method', () => {
50                 const component = shallow(<LoopStatus loopCache={loopCache}/>)
51
52                 expect(component).toMatchSnapshot();
53         });
54 });