Fix unable to set tosca function on complex type on input operation
[sdc.git] / catalog-ui / src / app / ng2 / pages / composition / interface-operatons / operation-creator / input-list / input-list.component.spec.ts
1 /*
2  * -
3  *  ============LICENSE_START=======================================================
4  *  Copyright (C) 2022 Nordix Foundation.
5  *  ================================================================================
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at
9  *
10  *       http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *
18  *  SPDX-License-Identifier: Apache-2.0
19  *  ============LICENSE_END=========================================================
20  */
21
22 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
23
24 import {InputListComponent} from './input-list.component';
25 import {TranslateModule} from '../../../../../shared/translator/translate.module';
26 import {Component, Input} from '@angular/core';
27 import {DataTypeModel} from '../../../../../../models/data-types';
28 import {TranslateService} from '../../../../../shared/translator/translate.service';
29 import {ToscaFunction} from '../../../../../../models/tosca-function';
30 import {InstanceFeDetails} from "../../../../../../models/instance-fe-details";
31 import {CustomToscaFunction} from "../../../../../../models/default-custom-functions";
32 import {SubPropertyToscaFunction} from "../../../../../../models/sub-property-tosca-function";
33
34 @Component({selector: 'app-input-list-item', template: ''})
35 class InputListItemStubComponent {
36   @Input() name: string;
37   @Input() type: DataTypeModel;
38   @Input() dataTypeMap: any;
39   @Input() valueObjRef: any;
40   @Input() subPropertyToscaFunctions: SubPropertyToscaFunction[];
41   @Input() schema: any;
42   @Input() allowDeletion: any;
43   @Input() isViewOnly: boolean;
44   @Input() toscaFunction: ToscaFunction;
45   @Input() showToscaFunctionOption: boolean;
46   @Input() componentInstanceMap: Map<string, InstanceFeDetails> = null;
47   @Input() customToscaFunctions: Array<CustomToscaFunction> = [];
48 }
49
50 const translateServiceMock: Partial<TranslateService> = {
51   translate: jest.fn((str: string) => {
52   })
53 };
54
55 describe('InputListComponent', () => {
56   let component: InputListComponent;
57   let fixture: ComponentFixture<InputListComponent>;
58
59   beforeEach(async(() => {
60     TestBed.configureTestingModule({
61       declarations: [ InputListComponent, InputListItemStubComponent ],
62       imports: [
63         TranslateModule
64       ],
65       providers: [
66         { provide: TranslateService, useValue: translateServiceMock }
67       ]
68     })
69     .compileComponents();
70   }));
71
72   beforeEach(() => {
73     fixture = TestBed.createComponent(InputListComponent);
74     component = fixture.componentInstance;
75     fixture.detectChanges();
76   });
77
78   it('should create', () => {
79     expect(component).toBeDefined();
80   });
81 });