blob: a3eed066cc23e943f49a479fe03e12b040dc3cf2 [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 { BackgroundSvgComponent } from './backgroundsvg.component';
Sean Condon0d064ec2019-02-04 21:53:53 +000019import {MapSvgComponent} from '../mapsvg/mapsvg.component';
20import {from} from 'rxjs';
21import {HttpClient} from '@angular/common/http';
22import {LogService} from 'gui2-fw-lib';
23import {MapObject} from '../maputils';
24
25class MockHttpClient {
26 get() {
27 return from(['{"id":"app","icon":"nav_apps","cat":"PLATFORM","label":"Applications"}']);
28 }
29
30 subscribe() {}
31}
Sean Condonf4f54a12018-10-10 23:25:46 +010032
33describe('BackgroundSvgComponent', () => {
Sean Condon0d064ec2019-02-04 21:53:53 +000034 let logServiceSpy: jasmine.SpyObj<LogService>;
Sean Condonf4f54a12018-10-10 23:25:46 +010035 let component: BackgroundSvgComponent;
36 let fixture: ComponentFixture<BackgroundSvgComponent>;
Sean Condon0d064ec2019-02-04 21:53:53 +000037 const testmap: MapObject = <MapObject>{
38 scale: 1.0,
39 id: 'test',
40 description: 'test map'
41 };
Sean Condonf4f54a12018-10-10 23:25:46 +010042
43 beforeEach(async(() => {
Sean Condon0d064ec2019-02-04 21:53:53 +000044 const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
45
Sean Condonf4f54a12018-10-10 23:25:46 +010046 TestBed.configureTestingModule({
Sean Condon0d064ec2019-02-04 21:53:53 +000047 declarations: [
48 BackgroundSvgComponent,
49 MapSvgComponent
50 ],
51 providers: [
52 { provide: LogService, useValue: logSpy },
53 { provide: HttpClient, useClass: MockHttpClient },
54 ]
Sean Condonf4f54a12018-10-10 23:25:46 +010055 })
56 .compileComponents();
Sean Condon0d064ec2019-02-04 21:53:53 +000057
58 logServiceSpy = TestBed.get(LogService);
Sean Condonf4f54a12018-10-10 23:25:46 +010059 }));
60
61 beforeEach(() => {
62 fixture = TestBed.createComponent(BackgroundSvgComponent);
63 component = fixture.componentInstance;
Sean Condon0d064ec2019-02-04 21:53:53 +000064 component.map = testmap;
Sean Condonf4f54a12018-10-10 23:25:46 +010065 fixture.detectChanges();
66 });
67
68 it('should create', () => {
69 expect(component).toBeTruthy();
70 });
71});