|
1 |
| -/* tslint:disable:no-unused-variable */ |
| 1 | +import { TestBed, async } from "@angular/core/testing"; |
| 2 | +import { AppComponent } from "./app.component"; |
| 3 | +import { LayoutStoreService } from "../shared/layout/layout-store.service"; |
| 4 | +import { AppSessionService } from "../shared/session/app-session.service"; |
| 5 | +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; |
2 | 6 |
|
3 |
| -import { TestBed, async } from '@angular/core/testing'; |
4 |
| -import { AppComponent } from './app.component'; |
| 7 | +import { CommonModule } from "@angular/common"; |
| 8 | +import { FormsModule, ReactiveFormsModule } from "@angular/forms"; |
| 9 | +import { HttpClientJsonpModule } from "@angular/common/http"; |
| 10 | +import { HttpClientModule } from "@angular/common/http"; |
| 11 | +import { ModalModule } from "ngx-bootstrap/modal"; |
| 12 | +import { BsDropdownModule } from "ngx-bootstrap/dropdown"; |
| 13 | +import { CollapseModule } from "ngx-bootstrap/collapse"; |
| 14 | +import { TabsModule } from "ngx-bootstrap/tabs"; |
| 15 | +import { NgxPaginationModule } from "ngx-pagination"; |
| 16 | +import { RouterTestingModule } from "@angular/router/testing"; |
| 17 | +import { ServiceProxyModule } from "../shared/service-proxies/service-proxy.module"; |
| 18 | +import { SharedModule } from "../shared/shared.module"; |
| 19 | +import { HomeComponent } from "../app/home/home.component"; |
| 20 | +import { AboutComponent } from "../app/about/about.component"; |
5 | 21 |
|
6 |
| -describe('AppComponent', () => { |
| 22 | +// layout |
| 23 | +import { HeaderComponent } from "./layout/header.component"; |
| 24 | +import { HeaderLeftNavbarComponent } from "./layout/header-left-navbar.component"; |
| 25 | +import { HeaderLanguageMenuComponent } from "./layout/header-language-menu.component"; |
| 26 | +import { HeaderUserMenuComponent } from "./layout/header-user-menu.component"; |
| 27 | +import { FooterComponent } from "./layout/footer.component"; |
| 28 | +import { SidebarComponent } from "./layout/sidebar.component"; |
| 29 | +import { SidebarLogoComponent } from "./layout/sidebar-logo.component"; |
| 30 | +import { SidebarUserPanelComponent } from "./layout/sidebar-user-panel.component"; |
| 31 | +import { SidebarMenuComponent } from "./layout/sidebar-menu.component"; |
| 32 | + |
| 33 | +describe("AppComponent", () => { |
7 | 34 | beforeEach(() => {
|
8 | 35 | TestBed.configureTestingModule({
|
9 | 36 | declarations: [
|
10 |
| - AppComponent |
| 37 | + AppComponent, |
| 38 | + HomeComponent, |
| 39 | + AboutComponent, |
| 40 | + |
| 41 | + // layout |
| 42 | + HeaderComponent, |
| 43 | + HeaderLeftNavbarComponent, |
| 44 | + HeaderLanguageMenuComponent, |
| 45 | + HeaderUserMenuComponent, |
| 46 | + FooterComponent, |
| 47 | + SidebarComponent, |
| 48 | + SidebarLogoComponent, |
| 49 | + SidebarUserPanelComponent, |
| 50 | + SidebarMenuComponent, |
| 51 | + ], |
| 52 | + imports: [ |
| 53 | + BrowserAnimationsModule, |
| 54 | + CommonModule, |
| 55 | + FormsModule, |
| 56 | + ReactiveFormsModule, |
| 57 | + HttpClientModule, |
| 58 | + HttpClientJsonpModule, |
| 59 | + ModalModule.forChild(), |
| 60 | + BsDropdownModule.forRoot(), |
| 61 | + CollapseModule.forRoot(), |
| 62 | + TabsModule.forRoot(), |
| 63 | + RouterTestingModule, |
| 64 | + ServiceProxyModule, |
| 65 | + SharedModule.forRoot(), |
| 66 | + NgxPaginationModule, |
| 67 | + ], |
| 68 | + providers: [ |
| 69 | + LayoutStoreService, |
| 70 | + { |
| 71 | + provide: AppSessionService, |
| 72 | + useValue: { |
| 73 | + application: { |
| 74 | + version: "", |
| 75 | + releaseDate: { |
| 76 | + format: function () { |
| 77 | + return ""; |
| 78 | + }, |
| 79 | + }, |
| 80 | + }, |
| 81 | + getShownLoginName: function(){ |
| 82 | + return 'admin'; |
| 83 | + } |
| 84 | + }, |
| 85 | + }, |
11 | 86 | ],
|
12 | 87 | });
|
13 | 88 | TestBed.compileComponents();
|
14 | 89 | });
|
15 | 90 |
|
16 |
| - it('should create the app', async(() => { |
| 91 | + it("should create the app", async(() => { |
17 | 92 | const fixture = TestBed.createComponent(AppComponent);
|
18 | 93 | const app = fixture.debugElement.componentInstance;
|
19 | 94 | expect(app).toBeTruthy();
|
20 | 95 | }));
|
21 |
| - |
22 |
| - it(`should have as title 'app works!'`, async(() => { |
23 |
| - const fixture = TestBed.createComponent(AppComponent); |
24 |
| - const app = fixture.debugElement.componentInstance; |
25 |
| - expect(app.title).toEqual('app works!'); |
26 |
| - })); |
27 |
| - |
28 |
| - it('should render title in a h1 tag', async(() => { |
29 |
| - const fixture = TestBed.createComponent(AppComponent); |
30 |
| - fixture.detectChanges(); |
31 |
| - const compiled = fixture.debugElement.nativeElement; |
32 |
| - expect(compiled.querySelector('h1').textContent).toContain('app works!'); |
33 |
| - })); |
| 96 | + |
34 | 97 | });
|
0 commit comments