Sean Condon | f4f54a1 | 2018-10-10 23:25:46 +0100 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
| 17 | |
| 18 | import { MapSvgComponent } from './mapsvg.component'; |
Sean Condon | 0d064ec | 2019-02-04 21:53:53 +0000 | [diff] [blame] | 19 | import {HttpClient} from '@angular/common/http'; |
| 20 | import {from} from 'rxjs'; |
Sean Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame^] | 21 | import {LogService} from 'gui2-fw-lib/public_api'; |
Sean Condon | 0d064ec | 2019-02-04 21:53:53 +0000 | [diff] [blame] | 22 | |
| 23 | class MockHttpClient { |
| 24 | get() { |
| 25 | return from(['{"id":"app","icon":"nav_apps","cat":"PLATFORM","label":"Applications"}']); |
| 26 | } |
| 27 | |
| 28 | subscribe() {} |
| 29 | } |
Sean Condon | f4f54a1 | 2018-10-10 23:25:46 +0100 | [diff] [blame] | 30 | |
| 31 | describe('MapSvgComponent', () => { |
Sean Condon | 0d064ec | 2019-02-04 21:53:53 +0000 | [diff] [blame] | 32 | let logServiceSpy: jasmine.SpyObj<LogService>; |
| 33 | let component: MapSvgComponent; |
| 34 | let fixture: ComponentFixture<MapSvgComponent>; |
Sean Condon | f4f54a1 | 2018-10-10 23:25:46 +0100 | [diff] [blame] | 35 | |
Sean Condon | 0d064ec | 2019-02-04 21:53:53 +0000 | [diff] [blame] | 36 | beforeEach(async(() => { |
| 37 | const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']); |
Sean Condon | f4f54a1 | 2018-10-10 23:25:46 +0100 | [diff] [blame] | 38 | |
Sean Condon | 0d064ec | 2019-02-04 21:53:53 +0000 | [diff] [blame] | 39 | TestBed.configureTestingModule({ |
| 40 | declarations: [ MapSvgComponent ], |
| 41 | providers: [ |
| 42 | { provide: LogService, useValue: logSpy }, |
| 43 | { provide: HttpClient, useClass: MockHttpClient }, |
| 44 | ] |
| 45 | }) |
| 46 | .compileComponents(); |
Sean Condon | f4f54a1 | 2018-10-10 23:25:46 +0100 | [diff] [blame] | 47 | |
Sean Condon | 0d064ec | 2019-02-04 21:53:53 +0000 | [diff] [blame] | 48 | 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 Condon | f4f54a1 | 2018-10-10 23:25:46 +0100 | [diff] [blame] | 60 | }); |