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=a3df258828e1f6040da993b18382ae3185e5278a;hb=94225563a68aecb49e713eb8508fb278682cec08;hp=094ff4541f438d4e410cfdb00169a6285a8f6ab2;hpb=0ad7c39f68411d7cbd1f013d1d46c8d4b1849bca;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..a3df258 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 { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { MatIconModule, MatTableModule } from '@angular/material'; +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'; describe('PolicyControlComponent', () => { let component: PolicyControlComponent; let fixture: ComponentFixture; beforeEach(async(() => { + const policyTypeDataSourceSpy = jasmine.createSpyObj('PolicyTypeDataSource', [ 'connect', 'loadTable', 'disconnect' ]); + const policyType = { + name: "type1", + schema: "{}", + schemaObject: "{}" + } + policyTypeDataSourceSpy.connect.and.returnValue(of([ policyType])); + 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(); + }); });