blob: e3efb3facd57563971b84df5061caaead76b9a7d [file] [log] [blame]
Sean Condon50855cf2018-12-23 15:37:42 +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 */
Sean Condon0c577f62018-11-18 22:40:05 +000016import { async, ComponentFixture, TestBed } from '@angular/core/testing';
17
18import { HostNodeSvgComponent } from './hostnodesvg.component';
Sean Condon50855cf2018-12-23 15:37:42 +000019import {ActivatedRoute, Params} from '@angular/router';
20import {of} from 'rxjs';
21import {LogService} from 'gui2-fw-lib';
22import {Host} from '../../models';
23import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
24import {ChangeDetectorRef} from '@angular/core';
25
26class MockActivatedRoute extends ActivatedRoute {
27 constructor(params: Params) {
28 super();
29 this.queryParams = of(params);
30 }
31}
Sean Condon0c577f62018-11-18 22:40:05 +000032
33describe('HostNodeSvgComponent', () => {
Sean Condon50855cf2018-12-23 15:37:42 +000034 let logServiceSpy: jasmine.SpyObj<LogService>;
35 let component: HostNodeSvgComponent;
36 let fixture: ComponentFixture<HostNodeSvgComponent>;
37 let ar: MockActivatedRoute;
38 let testHost: Host;
Sean Condon0c577f62018-11-18 22:40:05 +000039
Sean Condon50855cf2018-12-23 15:37:42 +000040 beforeEach(async(() => {
41 const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
42 ar = new MockActivatedRoute({ 'debug': 'txrx' });
43 testHost = new Host('host:1');
44 testHost.ips = ['10.205.86.123', '192.168.56.10'];
Sean Condon0c577f62018-11-18 22:40:05 +000045
Sean Condon50855cf2018-12-23 15:37:42 +000046 TestBed.configureTestingModule({
47 imports: [ BrowserAnimationsModule ],
48 declarations: [ HostNodeSvgComponent ],
49 providers: [
50 { provide: LogService, useValue: logSpy },
51 { provide: ActivatedRoute, useValue: ar },
52 { provide: ChangeDetectorRef, useClass: ChangeDetectorRef }
53 ]
54 })
55 .compileComponents();
56 logServiceSpy = TestBed.get(LogService);
57 }));
Sean Condon0c577f62018-11-18 22:40:05 +000058
Sean Condon50855cf2018-12-23 15:37:42 +000059 beforeEach(() => {
60 fixture = TestBed.createComponent(HostNodeSvgComponent);
61 component = fixture.componentInstance;
62 component.host = testHost;
63 fixture.detectChanges();
64 });
65
66 it('should create', () => {
67 expect(component).toBeTruthy();
68 });
Sean Condon0c577f62018-11-18 22:40:05 +000069});