Fix PolicyControlComponent
[portal/nonrtric-controlpanel.git] / webapp-frontend / src / app / policy / policy-type / policy-type.component.spec.ts
1 /*-
2  * ========================LICENSE_START=================================
3  * O-RAN-SC
4  * %%
5  * Copyright (C) 2021 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
21 import { async, ComponentFixture, TestBed } from "@angular/core/testing";
22
23 import { PolicyTypeComponent } from "./policy-type.component";
24 import { PolicyType } from "@interfaces/policy.types";
25 import { PolicyService } from "@services/policy/policy.service";
26 import { of } from "rxjs";
27
28 describe("PolicyTypeComponent", () => {
29   let component: PolicyTypeComponent;
30   let policyServiceSpy: jasmine.SpyObj<PolicyService>;
31   let fixture: ComponentFixture<PolicyTypeComponent>;
32
33   beforeEach(async(() => {
34     policyServiceSpy = jasmine.createSpyObj("PolicyService", ["getPolicyType"]);
35     const policyTypeSchema = JSON.parse(
36       '{"schemaObject": {"description": "Type 1 policy type"}}'
37     );
38     const policyType = { policy_schema: policyTypeSchema } as PolicyType;
39     policyServiceSpy.getPolicyType.and.returnValue(of(policyType));
40
41     TestBed.configureTestingModule({
42       declarations: [PolicyTypeComponent],
43       providers: [{ provide: PolicyService, useValue: policyServiceSpy }],
44     }).compileComponents();
45   }));
46
47   beforeEach(() => {
48     fixture = TestBed.createComponent(PolicyTypeComponent);
49     component = fixture.componentInstance;
50     fixture.detectChanges();
51   });
52
53   it("should create", () => {
54     expect(component).toBeTruthy();
55   });
56 });