3e0fbf5c257c12627c4c477a908f4b5793af6856
[portal/nonrtric-controlpanel.git] / webapp-frontend / src / app / ei-coordinator / ei-coordinator.component.spec.ts
1 /*-
2  * ========================LICENSE_START=================================
3  * O-RAN-SC
4  * %%
5  * Copyright (C) 2019 Nordix Foundation
6  * %%
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ========================LICENSE_END===================================
19  */
20 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
21 import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
22 import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
23 import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
24 import { MatIconModule, MatTableModule } from '@angular/material';
25
26 import { of } from 'rxjs';
27
28 import { EICoordinatorComponent } from './ei-coordinator.component';
29 import { EIJobDataSource } from './ei-job.datasource';
30 import { EIProducerDataSource } from './ei-producer.datasource';
31 import { UiService } from '../services/ui/ui.service';
32
33 describe('EICoordinatorComponent', () => {
34   let component: EICoordinatorComponent;
35   let fixture: ComponentFixture<EICoordinatorComponent>;
36
37   beforeEach(async(() => {
38     const jobDataSourceSpy = jasmine.createSpyObj('EIJobDataSource', [ 'connect', 'getJobs', 'disconnect' ]);
39     const producerDataSourceSpy = jasmine.createSpyObj('EIProducerDataSource', [ 'connect', 'loadTable', 'loadProducers',  'disconnect' ]);
40
41     jobDataSourceSpy.connect.and.returnValue(of([]));
42     jobDataSourceSpy.disconnect();
43     producerDataSourceSpy.connect.and.returnValue(of([]));
44     producerDataSourceSpy.loadProducers.and.returnValue(of([]));
45     producerDataSourceSpy.disconnect();
46
47     TestBed.configureTestingModule({
48       imports: [
49         MatIconModule,
50         MatTableModule,
51         BrowserAnimationsModule,
52         ReactiveFormsModule
53       ],
54       schemas: [
55         CUSTOM_ELEMENTS_SCHEMA
56       ],
57       declarations: [
58         EICoordinatorComponent
59       ],
60       providers: [
61         { provide: EIJobDataSource, useValue: jobDataSourceSpy },
62         { provide: EIProducerDataSource, useValue: producerDataSourceSpy },
63         UiService,
64         FormBuilder,
65       ]
66     })
67     .compileComponents();
68   }));
69
70   beforeEach(() => {
71     fixture = TestBed.createComponent(EICoordinatorComponent);
72     component = fixture.componentInstance;
73     fixture.detectChanges();
74   });
75
76   it('should create', () => {
77     expect(component).toBeTruthy();
78   });
79 });