Sean Condon | 83fc39f | 2018-04-19 18:56:13 +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 { TestBed, async } from '@angular/core/testing'; |
Sean Condon | 49e15be | 2018-05-16 16:58:29 +0100 | [diff] [blame] | 17 | import { RouterModule, RouterOutlet, ChildrenOutletContexts } from '@angular/router'; |
| 18 | import { LogService } from '../../app/log.service'; |
| 19 | import { ConsoleLoggerService } from '../../app/consolelogger.service'; |
| 20 | import { IconComponent } from '../../app/fw/svg/icon/icon.component'; |
| 21 | import { MastComponent } from '../../app/fw/mast/mast/mast.component'; |
| 22 | import { NavComponent } from '../../app/fw/nav/nav/nav.component'; |
Sean Condon | 83fc39f | 2018-04-19 18:56:13 +0100 | [diff] [blame] | 23 | import { OnosComponent } from '../../app/onos.component'; |
Sean Condon | 49e15be | 2018-05-16 16:58:29 +0100 | [diff] [blame] | 24 | import { DialogService } from '../../app/fw/layer/dialog.service'; |
| 25 | import { EeService } from '../../app/fw/util/ee.service'; |
Sean Condon | 49e15be | 2018-05-16 16:58:29 +0100 | [diff] [blame] | 26 | import { GlyphService } from '../../app/fw/svg/glyph.service'; |
| 27 | import { IconService } from '../../app/fw/svg/icon.service'; |
| 28 | import { KeyService } from '../../app/fw/util/key.service'; |
| 29 | import { LionService } from '../../app/fw/util/lion.service'; |
| 30 | import { NavService } from '../../app/fw/nav/nav.service'; |
| 31 | import { OnosService } from '../../app/onos.service'; |
| 32 | import { PanelService } from '../../app/fw/layer/panel.service'; |
| 33 | import { QuickHelpService } from '../../app/fw/layer/quickhelp.service'; |
| 34 | import { ThemeService } from '../../app/fw/util/theme.service'; |
| 35 | import { SpriteService } from '../../app/fw/svg/sprite.service'; |
| 36 | import { VeilService } from '../../app/fw/layer/veil.service'; |
| 37 | import { WebSocketService } from '../../app/fw/remote/websocket.service'; |
| 38 | |
| 39 | class MockDialogService {} |
| 40 | |
| 41 | class MockEeService {} |
| 42 | |
Sean Condon | 49e15be | 2018-05-16 16:58:29 +0100 | [diff] [blame] | 43 | class MockGlyphService {} |
| 44 | |
| 45 | class MockIconService {} |
| 46 | |
| 47 | class MockKeyService {} |
| 48 | |
| 49 | class MockLionService {} |
| 50 | |
| 51 | class MockNavService {} |
| 52 | |
| 53 | class MockOnosService {} |
| 54 | |
| 55 | class MockPanelService {} |
| 56 | |
| 57 | class MockQuickHelpService {} |
| 58 | |
| 59 | class MockSpriteService {} |
| 60 | |
| 61 | class MockThemeService {} |
| 62 | |
| 63 | class MockVeilService {} |
| 64 | |
| 65 | class MockWebSocketService {} |
Sean Condon | 83fc39f | 2018-04-19 18:56:13 +0100 | [diff] [blame] | 66 | |
| 67 | /** |
| 68 | * ONOS GUI -- Onos Component - Unit Tests |
| 69 | */ |
| 70 | describe('OnosComponent', () => { |
Sean Condon | 49e15be | 2018-05-16 16:58:29 +0100 | [diff] [blame] | 71 | let log: LogService; |
| 72 | |
| 73 | beforeEach(async(() => { |
| 74 | log = new ConsoleLoggerService(); |
| 75 | |
| 76 | TestBed.configureTestingModule({ |
| 77 | declarations: [ |
| 78 | IconComponent, |
| 79 | MastComponent, |
| 80 | NavComponent, |
| 81 | OnosComponent, |
| 82 | RouterOutlet |
| 83 | ], |
| 84 | providers: [ |
| 85 | { provide: ChildrenOutletContexts, useClass: ChildrenOutletContexts }, |
| 86 | { provide: DialogService, useClass: MockDialogService }, |
| 87 | { provide: EeService, useClass: MockEeService }, |
Sean Condon | 49e15be | 2018-05-16 16:58:29 +0100 | [diff] [blame] | 88 | { provide: GlyphService, useClass: MockGlyphService }, |
| 89 | { provide: IconService, useClass: MockIconService }, |
| 90 | { provide: KeyService, useClass: MockKeyService }, |
| 91 | { provide: LionService, useClass: MockLionService }, |
| 92 | { provide: LogService, useValue: log }, |
| 93 | { provide: NavService, useClass: MockNavService }, |
| 94 | { provide: OnosService, useClass: MockOnosService }, |
| 95 | { provide: QuickHelpService, useClass: MockQuickHelpService }, |
| 96 | { provide: PanelService, useClass: MockPanelService }, |
| 97 | { provide: SpriteService, useClass: MockSpriteService }, |
| 98 | { provide: ThemeService, useClass: MockThemeService }, |
| 99 | { provide: VeilService, useClass: MockVeilService }, |
| 100 | { provide: WebSocketService, useClass: MockWebSocketService }, |
| 101 | ] |
| 102 | }).compileComponents(); |
| 103 | })); |
| 104 | |
| 105 | it('should create the app', async(() => { |
| 106 | const fixture = TestBed.createComponent(OnosComponent); |
| 107 | const app = fixture.debugElement.componentInstance; |
| 108 | expect(app).toBeTruthy(); |
| 109 | })); |
| 110 | |
| 111 | it(`should have as title 'onos'`, async(() => { |
| 112 | const fixture = TestBed.createComponent(OnosComponent); |
| 113 | const app = fixture.debugElement.componentInstance; |
| 114 | expect(app.title).toEqual('onos'); |
| 115 | })); |
Sean Condon | 83fc39f | 2018-04-19 18:56:13 +0100 | [diff] [blame] | 116 | }); |