Make ei-coordinator tests work
[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 { EICoordinatorComponent } from './ei-coordinator.component';
27 import { EIJobDataSource } from './ei-job.datasource';
28 import { EIProducerDataSource } from './ei-producer.datasource';
29 import { UiService } from '../services/ui/ui.service';
30
31 describe('EICoordinatorComponent', () => {
32   let component: EICoordinatorComponent;
33   let fixture: ComponentFixture<EICoordinatorComponent>;
34
35   beforeEach(async(() => {
36     const jobDataSourceSpy = jasmine.createSpyObj('EIJobDataSource', [ 'loadJobs', 'eiJobs' ]);
37     const producerDataSourceSpy = jasmine.createSpyObj('EIProducerDataSource', [ 'loadProducers', 'eiProducers' ]);
38
39     jobDataSourceSpy.eiJobs.and.returnValue([]);
40
41     producerDataSourceSpy.eiProducers.and.returnValue([]);
42
43     TestBed.configureTestingModule({
44       imports: [
45         MatIconModule,
46         MatTableModule,
47         BrowserAnimationsModule,
48         ReactiveFormsModule
49       ],
50       schemas: [
51         CUSTOM_ELEMENTS_SCHEMA
52       ],
53       declarations: [
54         EICoordinatorComponent
55       ],
56       providers: [
57         { provide: EIJobDataSource, useValue: jobDataSourceSpy },
58         { provide: EIProducerDataSource, useValue: producerDataSourceSpy },
59         UiService,
60         FormBuilder,
61       ]
62     })
63     .compileComponents();
64   }));
65
66   beforeEach(() => {
67     fixture = TestBed.createComponent(EICoordinatorComponent);
68     component = fixture.componentInstance;
69     fixture.detectChanges();
70   });
71
72   it('should create', () => {
73     expect(component).toBeTruthy();
74   });
75 });