blob: 2831d976ba70e608383b8447f3c9572eacb82610 [file] [log] [blame]
Sean Condon83fc39f2018-04-19 18:56:13 +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 { TestBed, async } from '@angular/core/testing';
Sean Condon49e15be2018-05-16 16:58:29 +010017import { RouterModule, RouterOutlet, ChildrenOutletContexts } from '@angular/router';
18import { LogService } from '../../app/log.service';
19import { ConsoleLoggerService } from '../../app/consolelogger.service';
20import { IconComponent } from '../../app/fw/svg/icon/icon.component';
21import { MastComponent } from '../../app/fw/mast/mast/mast.component';
22import { NavComponent } from '../../app/fw/nav/nav/nav.component';
Sean Condon83fc39f2018-04-19 18:56:13 +010023import { OnosComponent } from '../../app/onos.component';
Sean Condon49e15be2018-05-16 16:58:29 +010024import { DialogService } from '../../app/fw/layer/dialog.service';
25import { EeService } from '../../app/fw/util/ee.service';
Sean Condon49e15be2018-05-16 16:58:29 +010026import { GlyphService } from '../../app/fw/svg/glyph.service';
27import { IconService } from '../../app/fw/svg/icon.service';
28import { KeyService } from '../../app/fw/util/key.service';
29import { LionService } from '../../app/fw/util/lion.service';
30import { NavService } from '../../app/fw/nav/nav.service';
31import { OnosService } from '../../app/onos.service';
32import { PanelService } from '../../app/fw/layer/panel.service';
33import { QuickHelpService } from '../../app/fw/layer/quickhelp.service';
34import { ThemeService } from '../../app/fw/util/theme.service';
35import { SpriteService } from '../../app/fw/svg/sprite.service';
36import { VeilService } from '../../app/fw/layer/veil.service';
37import { WebSocketService } from '../../app/fw/remote/websocket.service';
38
39class MockDialogService {}
40
41class MockEeService {}
42
Sean Condon49e15be2018-05-16 16:58:29 +010043class MockGlyphService {}
44
45class MockIconService {}
46
47class MockKeyService {}
48
49class MockLionService {}
50
51class MockNavService {}
52
53class MockOnosService {}
54
55class MockPanelService {}
56
57class MockQuickHelpService {}
58
59class MockSpriteService {}
60
61class MockThemeService {}
62
63class MockVeilService {}
64
65class MockWebSocketService {}
Sean Condon83fc39f2018-04-19 18:56:13 +010066
67/**
68 * ONOS GUI -- Onos Component - Unit Tests
69 */
70describe('OnosComponent', () => {
Sean Condon49e15be2018-05-16 16:58:29 +010071 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 Condon49e15be2018-05-16 16:58:29 +010088 { 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 Condon83fc39f2018-04-19 18:56:13 +0100116});