blob: 0f4feee253db16c68350df05850202cc2cdd3fca [file] [log] [blame]
Sean Condon0c577f62018-11-18 22:40:05 +00001/*
2 * Copyright 2018-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the 'License');
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an 'AS IS' BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import { async, ComponentFixture, TestBed } from '@angular/core/testing';
17
18import { DeviceNodeSvgComponent } from './devicenodesvg.component';
19import {LogService} from 'gui2-fw-lib';
20import {ActivatedRoute, Params} from '@angular/router';
21import {of} from 'rxjs';
22import {ChangeDetectorRef} from '@angular/core';
23import {Device} from '../../models';
24
25class MockActivatedRoute extends ActivatedRoute {
26 constructor(params: Params) {
27 super();
28 this.queryParams = of(params);
29 }
30}
31
32describe('DeviceNodeSvgComponent', () => {
33 let logServiceSpy: jasmine.SpyObj<LogService>;
34 let component: DeviceNodeSvgComponent;
35 let fixture: ComponentFixture<DeviceNodeSvgComponent>;
36 let ar: MockActivatedRoute;
37 let testDevice: Device;
38
39
40 beforeEach(async(() => {
41 const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
42 ar = new MockActivatedRoute({ 'debug': 'txrx' });
43 testDevice = new Device('test:1');
44 testDevice.online = true;
45
46 TestBed.configureTestingModule({
47 declarations: [ DeviceNodeSvgComponent ],
48 providers: [
49 { provide: LogService, useValue: logSpy },
50 { provide: ActivatedRoute, useValue: ar },
51 { provide: ChangeDetectorRef, useClass: ChangeDetectorRef }
52 ]
53 })
54 .compileComponents();
55 logServiceSpy = TestBed.get(LogService);
56 }));
57
58 beforeEach(() => {
59 fixture = TestBed.createComponent(DeviceNodeSvgComponent);
60 component = fixture.componentInstance;
61 component.device = testDevice;
62 fixture.detectChanges();
63 });
64
65 it('should create', () => {
66 expect(component).toBeTruthy();
67 });
68});