X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fpolicy-control%2Fpolicy-control.component.spec.ts;h=bcdb3f6b9d901aa421dd065d3f7c9f9f3c441496;hb=refs%2Fchanges%2F68%2F5668%2F5;hp=094ff4541f438d4e410cfdb00169a6285a8f6ab2;hpb=84d9bf693900acf8624290919255fccd331c54e4;p=portal%2Fnonrtric-controlpanel.git diff --git a/webapp-frontend/src/app/policy-control/policy-control.component.spec.ts b/webapp-frontend/src/app/policy-control/policy-control.component.spec.ts index 094ff45..bcdb3f6 100644 --- a/webapp-frontend/src/app/policy-control/policy-control.component.spec.ts +++ b/webapp-frontend/src/app/policy-control/policy-control.component.spec.ts @@ -18,19 +18,52 @@ * ========================LICENSE_END=================================== */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations' +import { MatDialog } from '@angular/material/dialog'; +import { MatIconModule } from '@angular/material/icon'; +import { MatTableModule } from '@angular/material/table'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { of } from 'rxjs'; +import { NotificationService } from '../services/ui/notification.service'; import { PolicyControlComponent } from './policy-control.component'; -import { MatIconModule, MatTableModule } from '@angular/material'; -import { PolicyType } from '../interfaces/policy.types'; +import { PolicyTypeDataSource } from './policy-type.datasource'; +import { UiService } from '../services/ui/ui.service'; +import { PolicyTypeSchema } from '../interfaces/policy.types'; describe('PolicyControlComponent', () => { let component: PolicyControlComponent; let fixture: ComponentFixture; beforeEach(async(() => { + const policyTypeDataSourceSpy = jasmine.createSpyObj('PolicyTypeDataSource', [ 'connect', 'getPolicyTypes', 'disconnect' ]); + var policyTypeSchema = {} as PolicyTypeSchema; + policyTypeSchema.name = ''; + policyTypeSchema.schemaObject = ''; + policyTypeDataSourceSpy.connect.and.returnValue(of([ policyTypeSchema])); + policyTypeDataSourceSpy.disconnect(); + + let matDialogStub: Partial; + let notificationServiceStub: Partial; + TestBed.configureTestingModule({ - imports: [ MatIconModule,MatTableModule ], - declarations: [ PolicyControlComponent ] + imports: [ + MatIconModule, + MatTableModule, + BrowserAnimationsModule + ], + schemas: [ + CUSTOM_ELEMENTS_SCHEMA + ], + declarations: [ + PolicyControlComponent + ], + providers: [ + { provide: PolicyTypeDataSource, useValue: policyTypeDataSourceSpy }, + { provide: MatDialog, useValue: matDialogStub }, + { provide: NotificationService, useValue: notificationServiceStub }, + UiService + ] }) .compileComponents(); })); @@ -41,4 +74,7 @@ describe('PolicyControlComponent', () => { fixture.detectChanges(); }); + it('should create', () => { + expect(component).toBeTruthy(); + }); });