blob: 5796ea927abfffcdb49c082ed91cd35849a26ff1 [file] [log] [blame]
Sean Condonf4f54a12018-10-10 23:25:46 +01001/*
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 { MapSvgComponent } from './mapsvg.component';
Sean Condon0d064ec2019-02-04 21:53:53 +000019import {HttpClient} from '@angular/common/http';
20import {from} from 'rxjs';
Sean Condon3b3fdab2020-04-14 09:25:00 +010021import {LogService} from 'org_onosproject_onos/web/gui2-fw-lib/public_api';
Sean Condon0d064ec2019-02-04 21:53:53 +000022
23class MockHttpClient {
24 get() {
25 return from(['{"id":"app","icon":"nav_apps","cat":"PLATFORM","label":"Applications"}']);
26 }
27
28 subscribe() {}
29}
Sean Condonf4f54a12018-10-10 23:25:46 +010030
31describe('MapSvgComponent', () => {
Sean Condon0d064ec2019-02-04 21:53:53 +000032 let logServiceSpy: jasmine.SpyObj<LogService>;
33 let component: MapSvgComponent;
34 let fixture: ComponentFixture<MapSvgComponent>;
Sean Condonf4f54a12018-10-10 23:25:46 +010035
Sean Condon0d064ec2019-02-04 21:53:53 +000036 beforeEach(async(() => {
37 const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
Sean Condonf4f54a12018-10-10 23:25:46 +010038
Sean Condon0d064ec2019-02-04 21:53:53 +000039 TestBed.configureTestingModule({
40 declarations: [ MapSvgComponent ],
41 providers: [
42 { provide: LogService, useValue: logSpy },
43 { provide: HttpClient, useClass: MockHttpClient },
44 ]
45 })
46 .compileComponents();
Sean Condonf4f54a12018-10-10 23:25:46 +010047
Sean Condon0d064ec2019-02-04 21:53:53 +000048 logServiceSpy = TestBed.get(LogService);
49 }));
50
51 beforeEach(() => {
52 fixture = TestBed.createComponent(MapSvgComponent);
53 component = fixture.componentInstance;
54 fixture.detectChanges();
55 });
56
57 it('should create', () => {
58 expect(component).toBeTruthy();
59 });
Sean Condonf4f54a12018-10-10 23:25:46 +010060});