blob: d70387e23eaaed31be268d62ff4724183d183b8c [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';
Sean Condon590b34b2019-12-04 18:44:37 +000025import {BadgeSvgComponent} from '../badgesvg/badgesvg.component';
Sean Condon50855cf2018-12-23 15:37:42 +000026
27class MockActivatedRoute extends ActivatedRoute {
28 constructor(params: Params) {
29 super();
30 this.queryParams = of(params);
31 }
32}
Sean Condon0c577f62018-11-18 22:40:05 +000033
34describe('HostNodeSvgComponent', () => {
Sean Condon50855cf2018-12-23 15:37:42 +000035 let logServiceSpy: jasmine.SpyObj<LogService>;
36 let component: HostNodeSvgComponent;
37 let fixture: ComponentFixture<HostNodeSvgComponent>;
38 let ar: MockActivatedRoute;
39 let testHost: Host;
Sean Condon0c577f62018-11-18 22:40:05 +000040
Sean Condon50855cf2018-12-23 15:37:42 +000041 beforeEach(async(() => {
42 const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
43 ar = new MockActivatedRoute({ 'debug': 'txrx' });
44 testHost = new Host('host:1');
45 testHost.ips = ['10.205.86.123', '192.168.56.10'];
Sean Condon0c577f62018-11-18 22:40:05 +000046
Sean Condon50855cf2018-12-23 15:37:42 +000047 TestBed.configureTestingModule({
48 imports: [ BrowserAnimationsModule ],
Sean Condon590b34b2019-12-04 18:44:37 +000049 declarations: [ HostNodeSvgComponent, BadgeSvgComponent ],
Sean Condon50855cf2018-12-23 15:37:42 +000050 providers: [
51 { provide: LogService, useValue: logSpy },
52 { provide: ActivatedRoute, useValue: ar },
53 { provide: ChangeDetectorRef, useClass: ChangeDetectorRef }
54 ]
55 })
56 .compileComponents();
57 logServiceSpy = TestBed.get(LogService);
58 }));
Sean Condon0c577f62018-11-18 22:40:05 +000059
Sean Condon50855cf2018-12-23 15:37:42 +000060 beforeEach(() => {
61 fixture = TestBed.createComponent(HostNodeSvgComponent);
62 component = fixture.componentInstance;
63 component.host = testHost;
64 fixture.detectChanges();
65 });
66
67 it('should create', () => {
68 expect(component).toBeTruthy();
69 });
Sean Condon0c577f62018-11-18 22:40:05 +000070});