Fix mod ui build issues
[dcaegen2/platform.git] / mod2 / ui / src / app / app.component.spec.ts
1 /* 
2  *  # ============LICENSE_START=======================================================
3  *  # Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
4  *  # ================================================================================
5  *  # Licensed under the Apache License, Version 2.0 (the "License");
6  *  # you may not use this file except in compliance with the License.
7  *  # You may obtain a copy of the License at
8  *  #
9  *  #      http://www.apache.org/licenses/LICENSE-2.0
10  *  #
11  *  # Unless required by applicable law or agreed to in writing, software
12  *  # distributed under the License is distributed on an "AS IS" BASIS,
13  *  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  # See the License for the specific language governing permissions and
15  *  # limitations under the License.
16  *  # ============LICENSE_END=========================================================
17  */
18
19 import { TestBed, async } from '@angular/core/testing';
20 import { RouterTestingModule } from '@angular/router/testing';
21 import { AppComponent } from './app.component';
22 import { Ng4LoadingSpinnerModule } from 'ng4-loading-spinner';
23 import { MatSidenavModule } from '@angular/material/sidenav';
24 import { MatToolbarModule } from '@angular/material/toolbar';
25 import { MatCardModule } from '@angular/material/card';
26 import { MatTreeModule } from '@angular/material/tree';
27 import { DialogModule } from 'primeng/dialog';
28 import { MatListModule } from '@angular/material/list';
29 import { LoginComponent } from './login/login.component';
30 import { FormsModule, ReactiveFormsModule } from '@angular/forms';
31 import { CardModule } from 'primeng/card';
32 import { HttpClientTestingModule } from '@angular/common/http/testing';
33 import { JwtHelperService, JwtModule, JWT_OPTIONS } from '@auth0/angular-jwt';
34
35 describe('AppComponent', () => {
36   beforeEach(async(() => {
37     TestBed.configureTestingModule({
38       imports: [
39         RouterTestingModule,
40         Ng4LoadingSpinnerModule,
41         MatSidenavModule,
42         MatToolbarModule,
43         MatCardModule,
44         MatTreeModule,
45         DialogModule,
46         MatListModule,
47         FormsModule,
48         ReactiveFormsModule,
49         CardModule,
50         HttpClientTestingModule,
51         JwtModule,
52       ],
53       declarations: [
54         AppComponent,
55         LoginComponent
56       ], providers: [
57         { provide: JWT_OPTIONS, useValue: JWT_OPTIONS },
58         JwtHelperService
59       ]
60     }).compileComponents();
61   }));
62
63   it('should create the app', () => {
64     const fixture = TestBed.createComponent(AppComponent);
65     const app = fixture.debugElement.componentInstance;
66     expect(app).toBeTruthy();
67   });
68
69   it(`should have as title 'mod-fe'`, () => {
70     const fixture = TestBed.createComponent(AppComponent);
71     const app = fixture.debugElement.componentInstance;
72     expect(app.title).toEqual('mod-fe');
73   });
74
75   it(`should have menu item variables as 'false'`, () => {
76     const fixture = TestBed.createComponent(AppComponent);
77     const app = fixture.debugElement.componentInstance;
78     expect(app.showUtilitiesMenu).toEqual(false);
79     expect(app.utilitiesMenuIconRight).toEqual(true);
80   });
81
82   it(`should change utilites menu arrow`, () => {
83     const fixture = TestBed.createComponent(AppComponent);
84     const app = fixture.debugElement.componentInstance;
85
86     app.utilitiesMenu()
87     expect(app.showUtilitiesMenu).toEqual(true);
88     expect(app.utilitiesMenuIconRight).toEqual(false);
89   });
90 });