Sean Condon | 49e15be | 2018-05-16 16:58:29 +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 | */ |
Sean Condon | 83fc39f | 2018-04-19 18:56:13 +0100 | [diff] [blame] | 16 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
| 17 | |
Sean Condon | 49e15be | 2018-05-16 16:58:29 +0100 | [diff] [blame^] | 18 | import { LogService } from '../../../../app/log.service'; |
| 19 | import { ConsoleLoggerService } from '../../../../app/consolelogger.service'; |
Sean Condon | 83fc39f | 2018-04-19 18:56:13 +0100 | [diff] [blame] | 20 | import { AppsComponent } from '../../../../app/view/apps/apps.component'; |
Sean Condon | 49e15be | 2018-05-16 16:58:29 +0100 | [diff] [blame^] | 21 | import { DialogService } from '../../../../app/fw/layer/dialog.service'; |
| 22 | import { FnService } from '../../../../app/fw/util/fn.service'; |
| 23 | import { IconService } from '../../../../app/fw/svg/icon.service'; |
| 24 | import { KeyService } from '../../../../app/fw/util/key.service'; |
| 25 | import { LionService } from '../../../../app/fw/util/lion.service'; |
| 26 | import { PanelService } from '../../../../app/fw/layer/panel.service'; |
| 27 | import { TableBuilderService } from '../../../../app/fw/widget/tablebuilder.service'; |
| 28 | import { UrlFnService } from '../../../../app/fw/remote/urlfn.service'; |
| 29 | import { WebSocketService } from '../../../../app/fw/remote/websocket.service'; |
Sean Condon | 83fc39f | 2018-04-19 18:56:13 +0100 | [diff] [blame] | 30 | |
Sean Condon | 49e15be | 2018-05-16 16:58:29 +0100 | [diff] [blame^] | 31 | class MockDialogService {} |
| 32 | |
| 33 | class MockFnService {} |
| 34 | |
| 35 | class MockIconService {} |
| 36 | |
| 37 | class MockKeyService {} |
| 38 | |
| 39 | class MockLionService {} |
| 40 | |
| 41 | class MockPanelService {} |
| 42 | |
| 43 | class MockTableBuilderService {} |
| 44 | |
| 45 | class MockUrlFnService {} |
| 46 | |
| 47 | class MockWebSocketService {} |
| 48 | |
| 49 | /** |
| 50 | * ONOS GUI -- Apps View -- Unit Tests |
| 51 | */ |
Sean Condon | 83fc39f | 2018-04-19 18:56:13 +0100 | [diff] [blame] | 52 | describe('AppsComponent', () => { |
Sean Condon | 49e15be | 2018-05-16 16:58:29 +0100 | [diff] [blame^] | 53 | let log: LogService; |
| 54 | let component: AppsComponent; |
| 55 | let fixture: ComponentFixture<AppsComponent>; |
| 56 | const windowMock = <any>{ location: <any> { hostname: 'localhost' } }; |
Sean Condon | 83fc39f | 2018-04-19 18:56:13 +0100 | [diff] [blame] | 57 | |
Sean Condon | 49e15be | 2018-05-16 16:58:29 +0100 | [diff] [blame^] | 58 | beforeEach(async(() => { |
| 59 | log = new ConsoleLoggerService(); |
Sean Condon | 83fc39f | 2018-04-19 18:56:13 +0100 | [diff] [blame] | 60 | |
Sean Condon | 49e15be | 2018-05-16 16:58:29 +0100 | [diff] [blame^] | 61 | TestBed.configureTestingModule({ |
| 62 | declarations: [ AppsComponent ], |
| 63 | providers: [ |
| 64 | { provide: DialogService, useClass: MockDialogService }, |
| 65 | { provide: FnService, useClass: MockFnService }, |
| 66 | { provide: IconService, useClass: MockIconService }, |
| 67 | { provide: KeyService, useClass: MockKeyService }, |
| 68 | { provide: LionService, useClass: MockLionService }, |
| 69 | { provide: LogService, useValue: log }, |
| 70 | { provide: PanelService, useClass: MockPanelService }, |
| 71 | { provide: TableBuilderService, useClass: MockTableBuilderService }, |
| 72 | { provide: UrlFnService, useClass: MockUrlFnService }, |
| 73 | { provide: WebSocketService, useClass: MockWebSocketService }, |
| 74 | { provide: Window, useValue: windowMock }, |
| 75 | ] |
| 76 | }) |
| 77 | .compileComponents(); |
| 78 | })); |
Sean Condon | 83fc39f | 2018-04-19 18:56:13 +0100 | [diff] [blame] | 79 | |
Sean Condon | 49e15be | 2018-05-16 16:58:29 +0100 | [diff] [blame^] | 80 | beforeEach(() => { |
| 81 | fixture = TestBed.createComponent(AppsComponent); |
| 82 | component = fixture.componentInstance; |
| 83 | fixture.detectChanges(); |
| 84 | }); |
| 85 | |
| 86 | it('should create', () => { |
| 87 | expect(component).toBeTruthy(); |
| 88 | }); |
Sean Condon | 83fc39f | 2018-04-19 18:56:13 +0100 | [diff] [blame] | 89 | }); |