Fix PolicyControlComponent
[portal/nonrtric-controlpanel.git] / webapp-frontend / src / app / policy / policy-control.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 { MatIconModule } from "@angular/material/icon";
23 import { MatTableModule } from "@angular/material/table";
24 import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
25 import { of } from "rxjs";
26
27 import { PolicyControlComponent } from "./policy-control.component";
28 import { PolicyTypeSchema } from "@interfaces/policy.types";
29 import { PolicyService } from "@services/policy/policy.service";
30
31 describe("PolicyControlComponent", () => {
32   let component: PolicyControlComponent;
33   let fixture: ComponentFixture<PolicyControlComponent>;
34
35   beforeEach(async(() => {
36     const policyServiceSpy = jasmine.createSpyObj("PolicyService", [
37       "getPolicyTypes",
38     ]);
39     var policyTypeSchema = {} as PolicyTypeSchema;
40     policyTypeSchema.name = "";
41     policyTypeSchema.schemaObject = "";
42     policyServiceSpy.getPolicyTypes.and.returnValue(of(["type1"]));
43
44     TestBed.configureTestingModule({
45       imports: [MatIconModule, MatTableModule, BrowserAnimationsModule],
46       schemas: [CUSTOM_ELEMENTS_SCHEMA],
47       declarations: [PolicyControlComponent],
48       providers: [{ provide: PolicyService, useValue: policyServiceSpy }],
49     }).compileComponents();
50   }));
51
52   beforeEach(() => {
53     fixture = TestBed.createComponent(PolicyControlComponent);
54     component = fixture.componentInstance;
55     fixture.detectChanges();
56   });
57
58   it("should create", () => {
59     expect(component).toBeTruthy();
60   });
61 });