diff options
Diffstat (limited to 'portal-FE-common/src/app/layout')
9 files changed, 67 insertions, 9 deletions
diff --git a/portal-FE-common/src/app/layout/components/footer/footer.component.spec.ts b/portal-FE-common/src/app/layout/components/footer/footer.component.spec.ts index b8340222..6e80fce5 100644 --- a/portal-FE-common/src/app/layout/components/footer/footer.component.spec.ts +++ b/portal-FE-common/src/app/layout/components/footer/footer.component.spec.ts @@ -36,6 +36,8 @@ * */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {HttpClientTestingModule} from '@angular/common/http/testing'; + import { FooterComponent } from './footer.component'; @@ -45,7 +47,8 @@ describe('FooterComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FooterComponent ] + declarations: [ FooterComponent], + imports: [HttpClientTestingModule] }) .compileComponents(); })); diff --git a/portal-FE-common/src/app/layout/components/global-search/global-search.component.spec.ts b/portal-FE-common/src/app/layout/components/global-search/global-search.component.spec.ts index c3771377..01879dd1 100644 --- a/portal-FE-common/src/app/layout/components/global-search/global-search.component.spec.ts +++ b/portal-FE-common/src/app/layout/components/global-search/global-search.component.spec.ts @@ -38,6 +38,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { GlobalSearchComponent } from './global-search.component'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { RouterTestingModule } from '@angular/router/testing'; describe('GlobalSearchComponent', () => { let component: GlobalSearchComponent; @@ -45,7 +47,8 @@ describe('GlobalSearchComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ GlobalSearchComponent ] + declarations: [ GlobalSearchComponent ], + imports: [HttpClientTestingModule, RouterTestingModule] }) .compileComponents(); })); diff --git a/portal-FE-common/src/app/layout/components/header-menu/header-menu.component.spec.ts b/portal-FE-common/src/app/layout/components/header-menu/header-menu.component.spec.ts index 889f499a..bd44038c 100644 --- a/portal-FE-common/src/app/layout/components/header-menu/header-menu.component.spec.ts +++ b/portal-FE-common/src/app/layout/components/header-menu/header-menu.component.spec.ts @@ -38,6 +38,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { HeaderMenuComponent } from './header-menu.component'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { RouterTestingModule } from '@angular/router/testing'; describe('HeaderMenuComponent', () => { let component: HeaderMenuComponent; @@ -45,7 +47,8 @@ describe('HeaderMenuComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ HeaderMenuComponent ] + declarations: [ HeaderMenuComponent ], + imports: [HttpClientTestingModule, RouterTestingModule] }) .compileComponents(); })); diff --git a/portal-FE-common/src/app/layout/components/header/header.component.spec.ts b/portal-FE-common/src/app/layout/components/header/header.component.spec.ts index 1bcd2ffb..fe571914 100644 --- a/portal-FE-common/src/app/layout/components/header/header.component.spec.ts +++ b/portal-FE-common/src/app/layout/components/header/header.component.spec.ts @@ -39,14 +39,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { HeaderComponent } from './header.component'; +import { Component } from '@angular/core'; +import { RouterLinkDirectiveStub } from 'src/testing/router-link-directive-stub'; +import { RouterTestingModule } from '@angular/router/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { CookieService } from 'ngx-cookie-service'; describe('HeaderComponent', () => { let component: HeaderComponent; let fixture: ComponentFixture<HeaderComponent>; + let cookieService: CookieService; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ HeaderComponent ] + declarations: [ HeaderComponent,AppHeaderMenuStubComponent,AppGlobalSearchStubComponent,RouterLinkDirectiveStub ], + imports: [RouterTestingModule,HttpClientTestingModule], + providers: [CookieService] }) .compileComponents(); })); @@ -54,6 +62,7 @@ describe('HeaderComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(HeaderComponent); component = fixture.componentInstance; + cookieService = TestBed.get(CookieService); fixture.detectChanges(); }); @@ -61,3 +70,10 @@ describe('HeaderComponent', () => { expect(component).toBeTruthy(); }); }); + +@Component({selector: 'app-header-menu', template: ''}) +class AppHeaderMenuStubComponent {} + +@Component({selector: 'app-global-search', template: ''}) +class AppGlobalSearchStubComponent {} + diff --git a/portal-FE-common/src/app/layout/components/search-users/search-users.component.spec.ts b/portal-FE-common/src/app/layout/components/search-users/search-users.component.spec.ts index 66a966cf..9db3e395 100644 --- a/portal-FE-common/src/app/layout/components/search-users/search-users.component.spec.ts +++ b/portal-FE-common/src/app/layout/components/search-users/search-users.component.spec.ts @@ -39,6 +39,9 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SearchUsersComponent } from './search-users.component'; +import { NgMaterialModule } from 'src/app/ng-material-module'; +import { FormsModule } from '@angular/forms'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; describe('SearchUsersComponent', () => { let component: SearchUsersComponent; @@ -46,7 +49,8 @@ describe('SearchUsersComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SearchUsersComponent ] + declarations: [ SearchUsersComponent ], + imports: [FormsModule,NgMaterialModule,HttpClientTestingModule] }) .compileComponents(); })); diff --git a/portal-FE-common/src/app/layout/components/sidebar/sidebar.component.spec.ts b/portal-FE-common/src/app/layout/components/sidebar/sidebar.component.spec.ts index 92caeb42..a9e39a07 100644 --- a/portal-FE-common/src/app/layout/components/sidebar/sidebar.component.spec.ts +++ b/portal-FE-common/src/app/layout/components/sidebar/sidebar.component.spec.ts @@ -38,6 +38,9 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SidebarComponent } from './sidebar.component'; +import { RouterLinkDirectiveStub } from 'src/testing/router-link-directive-stub'; +import { RouterTestingModule } from '@angular/router/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; describe('SidebarComponent', () => { let component: SidebarComponent; @@ -45,7 +48,8 @@ describe('SidebarComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SidebarComponent ] + declarations: [ SidebarComponent, RouterLinkDirectiveStub ], + imports: [RouterTestingModule,HttpClientTestingModule] }) .compileComponents(); })); diff --git a/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.spec.ts b/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.spec.ts index 94866e4e..76aaa3e7 100644 --- a/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.spec.ts +++ b/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.spec.ts @@ -39,6 +39,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { TabbarComponent } from './tabbar.component'; +import { NgMaterialModule } from 'src/app/ng-material-module'; +import { Component } from '@angular/core'; +import { ElipsisPipe } from 'src/app/shared/pipes/elipsis/elipsis.pipe'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; describe('TabbarComponent', () => { let component: TabbarComponent; @@ -46,7 +50,8 @@ describe('TabbarComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ TabbarComponent ] + declarations: [ TabbarComponent, AppSideBarStubComponent, AppUserBarStubComponent,RouterOutletStubComponent,AppFooterBarStubComponent,ElipsisPipe], + imports: [NgMaterialModule,BrowserAnimationsModule] }) .compileComponents(); })); @@ -61,3 +66,15 @@ describe('TabbarComponent', () => { expect(component).toBeTruthy(); }); }); + +@Component({selector: 'app-sidebar', template: ''}) +class AppSideBarStubComponent {} + +@Component({selector: 'router-outlet', template: ''}) +class RouterOutletStubComponent { } + +@Component({selector: 'app-userbar', template: ''}) +class AppUserBarStubComponent {} + +@Component({selector: 'app-footer', template: ''}) +class AppFooterBarStubComponent {} diff --git a/portal-FE-common/src/app/layout/components/userbar/userbar.component.spec.ts b/portal-FE-common/src/app/layout/components/userbar/userbar.component.spec.ts index 62b9c543..7aeb829d 100644 --- a/portal-FE-common/src/app/layout/components/userbar/userbar.component.spec.ts +++ b/portal-FE-common/src/app/layout/components/userbar/userbar.component.spec.ts @@ -39,6 +39,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { UserbarComponent } from './userbar.component'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; describe('UserbarComponent', () => { let component: UserbarComponent; @@ -46,7 +47,8 @@ describe('UserbarComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ UserbarComponent ] + declarations: [ UserbarComponent ], + imports: [HttpClientTestingModule] }) .compileComponents(); })); diff --git a/portal-FE-common/src/app/layout/layout.component.spec.ts b/portal-FE-common/src/app/layout/layout.component.spec.ts index 5184fe43..3074c297 100644 --- a/portal-FE-common/src/app/layout/layout.component.spec.ts +++ b/portal-FE-common/src/app/layout/layout.component.spec.ts @@ -38,6 +38,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { LayoutComponent } from './layout.component'; +import { Component } from '@angular/core'; describe('LayoutComponent', () => { let component: LayoutComponent; @@ -45,7 +46,7 @@ describe('LayoutComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ LayoutComponent ] + declarations: [ LayoutComponent,AppheaderStubComponent,AppTabBarStubComponent ] }) .compileComponents(); })); @@ -60,3 +61,8 @@ describe('LayoutComponent', () => { expect(component).toBeTruthy(); }); }); +@Component({selector: 'app-header', template: ''}) +class AppheaderStubComponent {} + +@Component({selector: 'app-tabbar', template: ''}) +class AppTabBarStubComponent { }
\ No newline at end of file |