2 * ========================LICENSE_START=================================
5 * Copyright (C) 2019 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===================================
20 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
21 import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
22 import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
23 import { MatDialog } from '@angular/material/dialog';
24 import { MatIconModule, MatTableModule } from '@angular/material';
25 import { of } from 'rxjs';
27 import { NotificationService } from '../services/ui/notification.service';
28 import { PolicyControlComponent } from './policy-control.component';
29 import { PolicyTypeDataSource } from './policy-type.datasource';
30 import { UiService } from '../services/ui/ui.service';
32 describe('PolicyControlComponent', () => {
33 let component: PolicyControlComponent;
34 let fixture: ComponentFixture<PolicyControlComponent>;
36 beforeEach(async(() => {
37 const policyTypeDataSourceSpy = jasmine.createSpyObj('PolicyTypeDataSource', [ 'connect', 'loadTable', 'disconnect' ]);
43 policyTypeDataSourceSpy.connect.and.returnValue(of([ policyType]));
44 policyTypeDataSourceSpy.disconnect();
46 let matDialogStub: Partial<MatDialog>;
47 let notificationServiceStub: Partial<NotificationService>;
49 TestBed.configureTestingModule({
53 BrowserAnimationsModule
56 CUSTOM_ELEMENTS_SCHEMA
59 PolicyControlComponent
62 { provide: PolicyTypeDataSource, useValue: policyTypeDataSourceSpy },
63 { provide: MatDialog, useValue: matDialogStub },
64 { provide: NotificationService, useValue: notificationServiceStub },
72 fixture = TestBed.createComponent(PolicyControlComponent);
73 component = fixture.componentInstance;
74 fixture.detectChanges();
77 it('should create', () => {
78 expect(component).toBeTruthy();