2 * ========================LICENSE_START=================================
5 * Copyright (C) 2021 Nordix Foundation
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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===================================
21 import { async, ComponentFixture, TestBed } from "@angular/core/testing";
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";
28 describe("PolicyTypeComponent", () => {
29 let component: PolicyTypeComponent;
30 let policyServiceSpy: jasmine.SpyObj<PolicyService>;
31 let fixture: ComponentFixture<PolicyTypeComponent>;
33 beforeEach(async(() => {
34 policyServiceSpy = jasmine.createSpyObj("PolicyService", ["getPolicyType"]);
35 const policyTypeSchema = JSON.parse(
36 '{"schemaObject": {"description": "Type 1 policy type"}}'
38 const policyType = { policy_schema: policyTypeSchema } as PolicyType;
39 policyServiceSpy.getPolicyType.and.returnValue(of(policyType));
41 TestBed.configureTestingModule({
42 declarations: [PolicyTypeComponent],
43 providers: [{ provide: PolicyService, useValue: policyServiceSpy }],
44 }).compileComponents();
48 fixture = TestBed.createComponent(PolicyTypeComponent);
49 component = fixture.componentInstance;
50 fixture.detectChanges();
53 it("should create", () => {
54 expect(component).toBeTruthy();