Fixed the test cases,added sonar config 84/102584/3
authorjegadeeshbabu3 <jegadeesh.babu@att.com>
Fri, 28 Feb 2020 12:12:20 +0000 (17:42 +0530)
committerJegadeesh Babu <jegadeesh.babu@att.com>
Fri, 28 Feb 2020 15:35:27 +0000 (15:35 +0000)
Fixed test cases and added sonar config details

Issue-ID: PORTAL-837
Change-Id: Ie4aa104871cfbbd6c6e36500f5ef2e250bafb575
Signed-off-by: jz385p <jegadeesh.babu@att.com>
86 files changed:
portal-FE-common/src/app/layout/components/footer/footer.component.spec.ts
portal-FE-common/src/app/layout/components/global-search/global-search.component.spec.ts
portal-FE-common/src/app/layout/components/header-menu/header-menu.component.spec.ts
portal-FE-common/src/app/layout/components/header/header.component.spec.ts
portal-FE-common/src/app/layout/components/search-users/search-users.component.spec.ts
portal-FE-common/src/app/layout/components/sidebar/sidebar.component.spec.ts
portal-FE-common/src/app/layout/components/tabbar/tabbar.component.spec.ts
portal-FE-common/src/app/layout/components/userbar/userbar.component.spec.ts
portal-FE-common/src/app/layout/layout.component.spec.ts
portal-FE-common/src/app/modals/confirmation-modal/confirmation-modal.component.spec.ts
portal-FE-common/src/app/modals/information-modal/information-modal.component.spec.ts
portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.spec.ts
portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.spec.ts
portal-FE-common/src/app/pages/admins/admins.component.spec.ts
portal-FE-common/src/app/pages/admins/new-admin/new-admin.component.spec.ts
portal-FE-common/src/app/pages/application-catalog/application-catalog.component.spec.ts
portal-FE-common/src/app/pages/catalog-modal/catalog-modal.component.spec.ts
portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.spec.ts
portal-FE-common/src/app/pages/contact-us/contact-us.component.spec.ts
portal-FE-common/src/app/pages/dashboard-application-catalog/dashboard-application-catalog.component.spec.ts
portal-FE-common/src/app/pages/dashboard-widget-catalog/dashboard-widget-catalog.component.spec.ts
portal-FE-common/src/app/pages/dashboard/dashboard.component.spec.ts
portal-FE-common/src/app/pages/functional-menu/functional-menu-dialog/functional-menu-dialog.component.spec.ts
portal-FE-common/src/app/pages/functional-menu/functional-menu.component.spec.ts
portal-FE-common/src/app/pages/functional-menu/functional-menu.component.ts
portal-FE-common/src/app/pages/get-access/get-access.component.spec.ts
portal-FE-common/src/app/pages/microservice-onboarding/microservice-add-details/microservice-add-details.component.spec.ts
portal-FE-common/src/app/pages/microservice-onboarding/microservice-onboarding.component.spec.ts
portal-FE-common/src/app/pages/notification-history/notification-history.component.spec.ts
portal-FE-common/src/app/pages/portal-admins/new-portal-admin/new-portal-admin.component.spec.ts
portal-FE-common/src/app/pages/portal-admins/portal-admins.component.spec.ts
portal-FE-common/src/app/pages/role/add-role/add-role.component.spec.ts
portal-FE-common/src/app/pages/role/bulk-upload-role/bulk-upload-role.component.spec.ts
portal-FE-common/src/app/pages/role/role-functions/role-function-modal/role-function-modal.component.spec.ts
portal-FE-common/src/app/pages/role/role-functions/role-functions.component.spec.ts
portal-FE-common/src/app/pages/role/role.component.spec.ts
portal-FE-common/src/app/pages/scheduler/scheduler.component.spec.ts
portal-FE-common/src/app/pages/user-notification-admin/new-notification-modal/new-notification-modal.component.spec.ts
portal-FE-common/src/app/pages/user-notification-admin/user-notification-admin.component.spec.ts
portal-FE-common/src/app/pages/users/bulk-user/bulk-user.component.spec.ts
portal-FE-common/src/app/pages/users/users.component.spec.ts
portal-FE-common/src/app/pages/web-analytics/web-analytics-details-dialog/web-analytics-details-dialog.component.spec.ts
portal-FE-common/src/app/pages/web-analytics/web-analytics.component.spec.ts
portal-FE-common/src/app/pages/widget-catalog/widget-catalog.component.spec.ts
portal-FE-common/src/app/pages/widget-onboarding/widget-details-dialog/widget-details-dialog.component.spec.ts
portal-FE-common/src/app/pages/widget-onboarding/widget-onboarding.component.spec.ts
portal-FE-common/src/app/pages/widgets/widgets.component.spec.ts
portal-FE-common/src/app/shared/pipes/elipsis/elipsis.pipe.spec.ts
portal-FE-common/src/app/shared/plugin/dynamic-widget/list-widget/list-widget.component.spec.ts
portal-FE-common/src/app/shared/plugin/plugin.component.spec.ts
portal-FE-common/src/app/shared/plugin/plugin.component.ts
portal-FE-common/src/app/shared/services/admins/admins.service.spec.ts
portal-FE-common/src/app/shared/services/application-catalog/application-catalog.service.spec.ts
portal-FE-common/src/app/shared/services/applications/applications.service.spec.ts
portal-FE-common/src/app/shared/services/basic-auth-account/basic-auth-account.service.spec.ts
portal-FE-common/src/app/shared/services/contact-us/contact-us.service.spec.ts
portal-FE-common/src/app/shared/services/external-request-access-service/external-request-access.service.spec.ts
portal-FE-common/src/app/shared/services/functional-menu/functional-menu.service.spec.ts
portal-FE-common/src/app/shared/services/get-access/get-access.service.spec.ts
portal-FE-common/src/app/shared/services/global-search/global-search.service.spec.ts
portal-FE-common/src/app/shared/services/manifest/manifest.service.spec.ts
portal-FE-common/src/app/shared/services/menus/menus.service.spec.ts
portal-FE-common/src/app/shared/services/microservice/microservice.service.spec.ts
portal-FE-common/src/app/shared/services/notification/notification.service.spec.ts
portal-FE-common/src/app/shared/services/portal-admins/portal-admin.service.spec.ts
portal-FE-common/src/app/shared/services/role/role.service.spec.ts
portal-FE-common/src/app/shared/services/scheduler/scheduler.service.spec.ts
portal-FE-common/src/app/shared/services/sidebar/sidebar.service.spec.ts
portal-FE-common/src/app/shared/services/tab/add-tab-function.service.spec.ts
portal-FE-common/src/app/shared/services/user-profile/user-profile.service.spec.ts
portal-FE-common/src/app/shared/services/userbar/userbar.service.spec.ts
portal-FE-common/src/app/shared/services/users/users.service.spec.ts
portal-FE-common/src/app/shared/services/utils/utils.service.spec.ts
portal-FE-common/src/app/shared/services/webAnalytics/web-analytics.service.spec.ts
portal-FE-common/src/app/shared/services/widget-catalog/widget-catalog.service.spec.ts
portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.spec.ts
portal-FE-os/package.json
portal-FE-os/pom.xml
portal-FE-os/src/app/app.component.spec.ts
portal-FE-os/src/app/pages/application-onboarding/application-details-dialog/application-details-dialog.component.spec.ts
portal-FE-os/src/app/pages/application-onboarding/application-details-dialog/application-details-dialog.component.ts
portal-FE-os/src/app/pages/application-onboarding/application-onboarding.component.spec.ts
portal-FE-os/src/app/pages/pages.component.spec.ts
portal-FE-os/src/app/pages/users/new-user-modal/new-user-modal.component.spec.ts
portal-FE-os/src/app/pages/users/user-details-form/user-details-form.component.spec.ts
portal-FE-os/src/testing/router-link-directive-stub.ts [new file with mode: 0644]

index b834022..6e80fce 100644 (file)
@@ -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();
   }));
index c377137..01879dd 100644 (file)
@@ -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();
   }));
index 889f499..bd44038 100644 (file)
@@ -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();
   }));
index 1bcd2ff..fe57191 100644 (file)
 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 {}
+
index 66a966c..9db3e39 100644 (file)
@@ -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();
   }));
index 92caeb4..a9e39a0 100644 (file)
@@ -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();
   }));
index 94866e4..76aaa3e 100644 (file)
 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 {}
index 62b9c54..7aeb829 100644 (file)
@@ -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();
   }));
index 5184fe4..3074c29 100644 (file)
@@ -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
index bc3516e..de3b534 100644 (file)
@@ -38,6 +38,7 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { ConfirmationModalComponent } from './confirmation-modal.component';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 
 describe('ConfirmationModalComponent', () => {
   let component: ConfirmationModalComponent;
@@ -45,7 +46,8 @@ describe('ConfirmationModalComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ ConfirmationModalComponent ]
+      declarations: [ ConfirmationModalComponent ],
+      providers: [NgbActiveModal]
     })
     .compileComponents();
   }));
index fa3596f..9e9a80b 100644 (file)
@@ -38,6 +38,7 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { InformationModalComponent } from './information-modal.component';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 
 describe('InformationModalComponent', () => {
   let component: InformationModalComponent;
@@ -45,7 +46,8 @@ describe('InformationModalComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ InformationModalComponent ]
+      declarations: [ InformationModalComponent ],
+      providers: [NgbActiveModal]
     })
     .compileComponents();
   }));
index fd56819..539055d 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { AccountAddDetailsComponent } from './account-add-details.component';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { FormsModule } from '@angular/forms';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 
 describe('AccountAddDetailsComponent', () => {
   let component: AccountAddDetailsComponent;
   let fixture: ComponentFixture<AccountAddDetailsComponent>;
+  const accountOnboarding: any = {"applicationName":"Portal-name"}
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ AccountAddDetailsComponent ]
+      declarations: [ AccountAddDetailsComponent ],
+      imports:[FormsModule,NgMaterialModule,HttpClientTestingModule],
+      providers: [NgbActiveModal]
     })
     .compileComponents();
   }));
@@ -53,6 +60,7 @@ describe('AccountAddDetailsComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(AccountAddDetailsComponent);
     component = fixture.componentInstance;
+    component.accountOnboarding = accountOnboarding;
     fixture.detectChanges();
   });
 
index 8e6e79e..f567ebe 100644 (file)
@@ -39,6 +39,9 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { AccountOnboardingComponent } from './account-onboarding.component';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('AccountOnboardingComponent', () => {
   let component: AccountOnboardingComponent;
@@ -46,7 +49,8 @@ describe('AccountOnboardingComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ AccountOnboardingComponent ]
+      declarations: [ AccountOnboardingComponent ],
+      imports: [NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule]
     })
     .compileComponents();
   }));
index 563f80f..c983cb9 100644 (file)
@@ -38,6 +38,9 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { AdminsComponent } from './admins.component';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('AdminsComponent', () => {
   let component: AdminsComponent;
@@ -45,7 +48,8 @@ describe('AdminsComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ AdminsComponent ]
+      declarations: [ AdminsComponent ],
+      imports: [NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule]
     })
     .compileComponents();
   }));
index 4040b0d..df1948e 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { NewAdminComponent } from './new-admin.component';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { Component, Input } from '@angular/core';
+import { RouterTestingModule } from '@angular/router/testing';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 
 describe('NewAdminComponent', () => {
   let component: NewAdminComponent;
@@ -45,7 +50,9 @@ describe('NewAdminComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ NewAdminComponent ]
+      declarations: [ NewAdminComponent,AppSearchUsersStubComponent ],
+      imports:[NgMaterialModule,RouterTestingModule,HttpClientTestingModule],
+      providers:[NgbActiveModal]
     })
     .compileComponents();
   }));
@@ -60,3 +67,8 @@ describe('NewAdminComponent', () => {
     expect(component).toBeTruthy();
   });
 });
+@Component({selector: 'app-search-users', template: ''})
+class AppSearchUsersStubComponent {
+  @Input()searchTitle:any;
+  @Input()placeHolder:any;
+ }
index 1967d25..ea2cfdd 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { ApplicationCatalogComponent } from './application-catalog.component';
+import { RouterLinkDirectiveStub } from 'src/testing/router-link-directive-stub';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { GridsterModule } from 'angular-gridster2';
+import { ElipsisPipe } from 'src/app/shared/pipes/elipsis/elipsis.pipe';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('ApplicationCatalogComponent', () => {
   let component: ApplicationCatalogComponent;
@@ -45,7 +51,8 @@ describe('ApplicationCatalogComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ ApplicationCatalogComponent ]
+      declarations: [ ApplicationCatalogComponent,RouterLinkDirectiveStub,ElipsisPipe],
+      imports: [FormsModule,NgMaterialModule,GridsterModule,HttpClientTestingModule]
     })
     .compileComponents();
   }));
index b37696f..064ec10 100644 (file)
@@ -38,6 +38,7 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { CatalogModalComponent } from './catalog-modal.component';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 
 describe('CatalogModalComponent', () => {
   let component: CatalogModalComponent;
@@ -45,7 +46,8 @@ describe('CatalogModalComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ CatalogModalComponent ]
+      declarations: [ CatalogModalComponent ],
+      providers: [NgbActiveModal]
     })
     .compileComponents();
   }));
index 06b6995..21224c0 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { ContactUsManageComponent } from './contact-us-manage.component';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { Component } from '@angular/core';
 
 describe('ContactUsManageComponent', () => {
   let component: ContactUsManageComponent;
@@ -46,7 +52,9 @@ describe('ContactUsManageComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ ContactUsManageComponent ]
+      declarations: [ ContactUsManageComponent ],
+      imports: [FormsModule, NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule],
+      providers: [NgbActiveModal]
     })
     .compileComponents();
   }));
@@ -61,3 +69,5 @@ describe('ContactUsManageComponent', () => {
     expect(component).toBeTruthy();
   });
 });
+
+
index db77e07..6b38cbd 100644 (file)
@@ -39,6 +39,8 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { ContactUsComponent } from './contact-us.component';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('ContactUsComponent', () => {
   let component: ContactUsComponent;
@@ -46,7 +48,8 @@ describe('ContactUsComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ ContactUsComponent ]
+      declarations: [ ContactUsComponent ],
+      imports: [NgMaterialModule,HttpClientTestingModule]
     })
     .compileComponents();
   }));
index 48c9180..42f130a 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { DashboardApplicationCatalogComponent } from './dashboard-application-catalog.component';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { FormsModule } from '@angular/forms';
+import { GridsterModule } from 'angular-gridster2';
+import { ElipsisPipe } from 'src/app/shared/pipes/elipsis/elipsis.pipe';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('DashboardApplicationCatalogComponent', () => {
   let component: DashboardApplicationCatalogComponent;
@@ -45,7 +51,8 @@ describe('DashboardApplicationCatalogComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ DashboardApplicationCatalogComponent ]
+      declarations: [ DashboardApplicationCatalogComponent,ElipsisPipe ],
+      imports: [NgMaterialModule,FormsModule,GridsterModule,HttpClientTestingModule,BrowserAnimationsModule]
     })
     .compileComponents();
   }));
index 7ae5f77..768895a 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { DashboardWidgetCatalogComponent } from './dashboard-widget-catalog.component';
+import { Component, Input } from '@angular/core';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { GridsterModule } from 'angular-gridster2';
+import { ElipsisPipe } from 'src/app/shared/pipes/elipsis/elipsis.pipe';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('DashboardWidgetCatalogComponent', () => {
   let component: DashboardWidgetCatalogComponent;
   let fixture: ComponentFixture<DashboardWidgetCatalogComponent>;
 
+
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ DashboardWidgetCatalogComponent ]
+      declarations: [ DashboardWidgetCatalogComponent,AppDynamicWidgetStubComponent,ElipsisPipe ],
+      imports:[NgMaterialModule,GridsterModule,HttpClientTestingModule]
     })
     .compileComponents();
   }));
@@ -60,3 +67,8 @@ describe('DashboardWidgetCatalogComponent', () => {
     expect(component).toBeTruthy();
   });
 });
+
+@Component({selector: 'app-dynamic-widget', template: ''})
+class AppDynamicWidgetStubComponent {
+  @Input() widgetType:any;
+}
\ No newline at end of file
index 9c996c3..3c8a7e0 100644 (file)
@@ -1,6 +1,8 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { DashboardComponent } from './dashboard.component';
+import { Component } from '@angular/core';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('DashboardComponent', () => {
   let component: DashboardComponent;
@@ -8,7 +10,8 @@ describe('DashboardComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ DashboardComponent ]
+      declarations: [ DashboardComponent, AppDashBoardApplicationCatalogComponent,AppDashBoardWidgetCatalogComponent ],
+      imports:[HttpClientTestingModule]
     })
     .compileComponents();
   }));
@@ -23,3 +26,9 @@ describe('DashboardComponent', () => {
     expect(component).toBeTruthy();
   });
 });
+
+@Component({selector: 'app-dashboard-application-catalog', template: ''})
+class AppDashBoardApplicationCatalogComponent {}
+
+@Component({selector: 'app-dashboard-widget-catalog', template: ''})
+class AppDashBoardWidgetCatalogComponent {}
index de79b9d..439a2ee 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { FunctionalMenuDialogComponent } from './functional-menu-dialog.component';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('FunctionalMenuDialogComponent', () => {
   let component: FunctionalMenuDialogComponent;
   let fixture: ComponentFixture<FunctionalMenuDialogComponent>;
+  const nodedata: any = {"parentMenuId":"parentMenuTestId","children":{},"name":"TestName","parent":{"name":"TestParentName"}};
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ FunctionalMenuDialogComponent ]
+      declarations: [ FunctionalMenuDialogComponent ],
+      imports:[FormsModule,NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule],
+      providers:[NgbActiveModal]
     })
     .compileComponents();
   }));
@@ -54,6 +62,7 @@ describe('FunctionalMenuDialogComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(FunctionalMenuDialogComponent);
     component = fixture.componentInstance;
+    component.nodedata = nodedata;
     fixture.detectChanges();
   });
 
index c5c562e..ef05c22 100644 (file)
@@ -1,6 +1,7 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { FunctionalMenuComponent } from './functional-menu.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('FunctionalMenuComponent', () => {
   let component: FunctionalMenuComponent;
@@ -8,7 +9,8 @@ describe('FunctionalMenuComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ FunctionalMenuComponent ]
+      declarations: [ FunctionalMenuComponent ],
+      imports:[HttpClientTestingModule]
     })
     .compileComponents();
   }));
index 655b4cb..d3b5a16 100644 (file)
@@ -152,41 +152,42 @@ export class FunctionalMenuComponent implements OnInit {
    */
   buildTree(treedataarray,ngbModal: NgbModal , _self){
     //console.log("treedataarray>>>>",treedataarray);
-    $(function() {
-        $('#jqTree').tree('loadData', treedataarray);
-        $('#jqTree').tree({
-            data: treedataarray,
-            autoOpen: false,
-            dragAndDrop: true,
-            onCreateLi: function(node, $li) {
-                ////console.log("node >>",node);
-            }
-        }).on(
-          'tree.contextmenu',
-          function(event:any) {
-              // The clicked node is 'event.node'
-              var node = event.node;
-              openMenuDetailsModal(node, "view");
-          }
-        );
+  //   $(function() {
+  //       $('#jqTree').tree('loadData', treedataarray);
+  //       $('#jqTree').tree({
+  //           data: treedataarray,
+  //           autoOpen: false,
+  //           dragAndDrop: true,
+  //           onCreateLi: function(node, $li) {
+  //               ////console.log("node >>",node);
+  //           }
+  //       }).on(
+  //         'tree.contextmenu',
+  //         function(event:any) {
+  //             // The clicked node is 'event.node'
+  //             var node = event.node;
+  //             openMenuDetailsModal(node, "view");
+  //         }
+  //       );
 
-        var openMenuDetailsModal = function(node: any, actionName: string ){
-          const modalRef = ngbModal.open(FunctionalMenuDialogComponent, { size: 'lg' });
-          modalRef.componentInstance.title = 'Functional Menu ',actionName;
-          if(node != 'undefined' && node){
-            modalRef.componentInstance.nodedata = node;
-            modalRef.componentInstance.operationName = actionName;
-          }else{
-            modalRef.componentInstance.nodedata  = {};
-          }
-          modalRef.componentInstance.passEntry.subscribe((receivedEntry: any) => {
-            //console.log("receivedEntry>>>>",receivedEntry);
-            ngbModal.dismissAll();
-            if(receivedEntry.httpStatusCode===200){
-              _self.getFunctionalMenu();
-            }
-          });
-        }
-     });
+  //       var openMenuDetailsModal = function(node: any, actionName: string ){
+  //         const modalRef = ngbModal.open(FunctionalMenuDialogComponent, { size: 'lg' });
+  //         modalRef.componentInstance.title = 'Functional Menu ',actionName;
+  //         if(node != 'undefined' && node){
+  //           modalRef.componentInstance.nodedata = node;
+  //           modalRef.componentInstance.operationName = actionName;
+  //         }else{
+  //           modalRef.componentInstance.nodedata  = {};
+  //         }
+  //         modalRef.componentInstance.passEntry.subscribe((receivedEntry: any) => {
+  //           //console.log("receivedEntry>>>>",receivedEntry);
+  //           ngbModal.dismissAll();
+  //           if(receivedEntry.httpStatusCode===200){
+  //             _self.getFunctionalMenu();
+  //           }
+  //         });
+  //       }
+  //    });
+  // }
   }
 }
index ae61740..0594fcc 100644 (file)
@@ -1,6 +1,9 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { GetAccessComponent } from './get-access.component';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('GetAccessComponent', () => {
   let component: GetAccessComponent;
@@ -8,7 +11,8 @@ describe('GetAccessComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ GetAccessComponent ]
+      declarations: [ GetAccessComponent ],
+      imports:[NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule]
     })
     .compileComponents();
   }));
index 5589854..f2344bd 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { MicroserviceAddDetailsComponent } from './microservice-add-details.component';
+import { ReactiveFormsModule, FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { IMircroservies } from 'src/app/shared/model/microservice-onboarding/microservices';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('MicroserviceAddDetailsComponent', () => {
   let component: MicroserviceAddDetailsComponent;
   let fixture: ComponentFixture<MicroserviceAddDetailsComponent>;
+  const ms: IMircroservies = {"name":"MicorserviceName"};
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ MicroserviceAddDetailsComponent ]
+      declarations: [ MicroserviceAddDetailsComponent ],
+      imports: [ReactiveFormsModule,FormsModule,NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule],
+      providers:[NgbActiveModal]
     })
     .compileComponents();
   }));
@@ -53,6 +62,7 @@ describe('MicroserviceAddDetailsComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(MicroserviceAddDetailsComponent);
     component = fixture.componentInstance;
+    component.ms = ms;
     fixture.detectChanges();
   });
 
index 09d30a1..6068590 100644 (file)
@@ -39,6 +39,9 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { MicroserviceOnboardingComponent } from './microservice-onboarding.component';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('MicroserviceOnboardingComponent', () => {
   let component: MicroserviceOnboardingComponent;
@@ -46,7 +49,8 @@ describe('MicroserviceOnboardingComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ MicroserviceOnboardingComponent ]
+      declarations: [ MicroserviceOnboardingComponent ],
+      imports:[NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule]
     })
     .compileComponents();
   }));
index 6896359..68da263 100644 (file)
@@ -39,6 +39,9 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { NotificationHistoryComponent } from './notification-history.component';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('NotificationHistoryComponent', () => {
   let component: NotificationHistoryComponent;
@@ -46,7 +49,8 @@ describe('NotificationHistoryComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ NotificationHistoryComponent ]
+      declarations: [ NotificationHistoryComponent ],
+      imports:[NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule]
     })
     .compileComponents();
   }));
index cd85fca..131d2af 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { NewPortalAdminComponent } from './new-portal-admin.component';
+import { Component, Input } from '@angular/core';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('NewPortalAdminComponent', () => {
   let component: NewPortalAdminComponent;
@@ -45,7 +49,9 @@ describe('NewPortalAdminComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ NewPortalAdminComponent ]
+      declarations: [ NewPortalAdminComponent,AppSearchUsersStubComponent ],
+      providers:[NgbActiveModal],
+      imports:[HttpClientTestingModule]
     })
     .compileComponents();
   }));
@@ -60,3 +66,9 @@ describe('NewPortalAdminComponent', () => {
     expect(component).toBeTruthy();
   });
 });
+
+@Component({selector: 'app-search-users', template: ''})
+class AppSearchUsersStubComponent { 
+  @Input() searchTitle:any;
+  @Input() placeHolder:any;
+}
index 0e3c969..d8cdbc2 100644 (file)
@@ -38,6 +38,9 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { PortalAdminsComponent } from './portal-admins.component';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('PortalAdminsComponent', () => {
   let component: PortalAdminsComponent;
@@ -45,7 +48,8 @@ describe('PortalAdminsComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ PortalAdminsComponent ]
+      declarations: [ PortalAdminsComponent ],
+      imports:[NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule]
     })
     .compileComponents();
   }));
index 1104010..1894fa8 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { AddRoleComponent } from './add-role.component';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('AddRoleComponent', () => {
   let component: AddRoleComponent;
@@ -45,7 +49,9 @@ describe('AddRoleComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ AddRoleComponent ]
+      declarations: [ AddRoleComponent ],
+      imports:[FormsModule,NgMaterialModule,HttpClientTestingModule],
+      providers:[NgbActiveModal]
     })
     .compileComponents();
   }));
index d4006a0..db83c1a 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { BulkUploadRoleComponent } from './bulk-upload-role.component';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 
 describe('BulkUploadRoleComponent', () => {
   let component: BulkUploadRoleComponent;
@@ -45,7 +49,9 @@ describe('BulkUploadRoleComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ BulkUploadRoleComponent ]
+      declarations: [ BulkUploadRoleComponent ],
+      imports:[FormsModule,NgMaterialModule,HttpClientTestingModule],
+      providers:[NgbActiveModal]
     })
     .compileComponents();
   }));
@@ -59,4 +65,43 @@ describe('BulkUploadRoleComponent', () => {
   it('should create', () => {
     expect(component).toBeTruthy();
   });
+
+  it('changeUploadTypeInstruction should return stubbed value', () => {
+    spyOn(component, 'changeUploadTypeInstruction').and.callThrough();
+    component.changeUploadTypeInstruction("functions");
+    expect(component.changeUploadTypeInstruction).toHaveBeenCalledWith("functions");
+    component.changeUploadTypeInstruction("roles");
+    expect(component.changeUploadTypeInstruction).toHaveBeenCalledWith("roles");
+    component.changeUploadTypeInstruction("roleFunctions");
+    expect(component.changeUploadTypeInstruction).toHaveBeenCalledWith("roleFunctions"); 
+    component.changeUploadTypeInstruction("default");
+    expect(component.changeUploadTypeInstruction).toHaveBeenCalledWith("default") ;
+  });
+
+  it('navigateUploadScreen should return stubbed value', () => {
+    spyOn(component, 'navigateUploadScreen').and.callThrough();
+    component.selectedUploadDropdown.value='functions';
+    component.navigateUploadScreen();
+    expect(component.navigateUploadScreen).toHaveBeenCalledWith();
+    component.selectedUploadDropdown.value='roles';
+    component.navigateUploadScreen();
+    expect(component.navigateUploadScreen).toHaveBeenCalledWith();
+    component.selectedUploadDropdown.value='roleFunctions';
+    component.navigateUploadScreen();
+    expect(component.navigateUploadScreen).toHaveBeenCalledWith();
+    component.selectedUploadDropdown.value='default';
+    component.navigateUploadScreen();
+    expect(component.navigateUploadScreen).toHaveBeenCalledWith();
+  });
+  it('navigateSelectTypeUpload should return stubbed value', () => {
+    spyOn(component, 'navigateSelectTypeUpload').and.callThrough();
+    component.navigateSelectTypeUpload();
+    expect(component.navigateSelectTypeUpload).toHaveBeenCalledWith();
+  });
+  
+  it('getSortOrder should return stubbed value', () => {
+    spyOn(component, 'getSortOrder').and.callThrough();
+    component.getSortOrder(1,true);
+    expect(component.getSortOrder).toHaveBeenCalledWith(1,true);
+  });
 });
index 2c5ef63..1ea7324 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { RoleFunctionModalComponent } from './role-function-modal.component';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('RoleFunctionModalComponent', () => {
   let component: RoleFunctionModalComponent;
@@ -45,7 +49,9 @@ describe('RoleFunctionModalComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ RoleFunctionModalComponent ]
+      declarations: [ RoleFunctionModalComponent ],
+      imports:[FormsModule,NgMaterialModule,HttpClientTestingModule],
+      providers:[NgbActiveModal]
     })
     .compileComponents();
   }));
index ccefb8d..8aa41e0 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { RoleFunctionsComponent } from './role-functions.component';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('RoleFunctionsComponent', () => {
   let component: RoleFunctionsComponent;
@@ -45,7 +49,8 @@ describe('RoleFunctionsComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ RoleFunctionsComponent ]
+      declarations: [ RoleFunctionsComponent ],
+      imports:[FormsModule,NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule],
     })
     .compileComponents();
   }));
index 2dc104d..1ae0caa 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { RoleComponent } from './role.component';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { RouterLinkDirectiveStub } from 'src/testing/router-link-directive-stub';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
+import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
+import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
+import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
+import { BulkUploadRoleComponent } from './bulk-upload-role/bulk-upload-role.component';
+import { AddRoleComponent } from './add-role/add-role.component';
 
 describe('RoleComponent', () => {
   let component: RoleComponent;
@@ -45,8 +56,9 @@ describe('RoleComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ RoleComponent ]
-    })
+      declarations: [ RoleComponent,RouterLinkDirectiveStub,InformationModalComponent,ConfirmationModalComponent,BulkUploadRoleComponent,AddRoleComponent ],
+      imports:[FormsModule,NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule,NgbModule.forRoot()],
+    }).overrideModule(BrowserDynamicTestingModule, { set: { entryComponents: [InformationModalComponent,ConfirmationModalComponent,BulkUploadRoleComponent,AddRoleComponent] } })
     .compileComponents();
   }));
 
@@ -59,4 +71,59 @@ describe('RoleComponent', () => {
   it('should create', () => {
     expect(component).toBeTruthy();
   });
+
+  it('toggleRole should return stubbed value', () => {
+    spyOn(component, 'toggleRole').and.callThrough();
+    let element={"id":1,"active":true};
+    component.toggleRole(element);
+    expect(component.toggleRole).toHaveBeenCalledWith(element);
+  });
+
+  it('openBulkUploadRolesAndFunctionsModal should return stubbed value', () => {
+    spyOn(component, 'openBulkUploadRolesAndFunctionsModal').and.callThrough();
+    component.openBulkUploadRolesAndFunctionsModal();
+    expect(component.openBulkUploadRolesAndFunctionsModal).toHaveBeenCalledWith();
+  });
+  it('editRoleModalPopup should return stubbed value', () => {
+    spyOn(component, 'editRoleModalPopup').and.callThrough();
+    let element={"id":1,"active":true};
+    component.editRoleModalPopup(element);
+    expect(component.editRoleModalPopup).toHaveBeenCalledWith(element);
+  });
+
+  it('addRoleModalPopup should return stubbed value', () => {
+    spyOn(component, 'addRoleModalPopup').and.callThrough();
+    component.addRoleModalPopup();
+    expect(component.addRoleModalPopup).toHaveBeenCalledWith();
+  });
+
+  it('removeRole should return stubbed value', () => {
+    spyOn(component, 'removeRole').and.callThrough();
+    let element={"id":1,"active":true,"name":"Test_global_"};
+    component.selectedCentralizedApp = 2;
+    component.removeRole(element);
+    expect(component.removeRole).toHaveBeenCalledWith(element);
+  });
+  it('getCentralizedApps should return stubbed value', () => {
+    spyOn(component, 'getCentralizedApps').and.callThrough();
+    component.getCentralizedApps('admin');
+    expect(component.getCentralizedApps).toHaveBeenCalledWith('admin');
+  });
+  it('syncRolesFromExternalAuthSystem should return stubbed value', () => {
+    spyOn(component, 'syncRolesFromExternalAuthSystem').and.callThrough();
+    component.selectedCentralizedApp = 'Test';
+    component.syncRolesFromExternalAuthSystem();
+    expect(component.syncRolesFromExternalAuthSystem).toHaveBeenCalledWith();
+  });
+  it('getRolesForSelectedCentralizedApp should return stubbed value', () => {
+    spyOn(component, 'getRolesForSelectedCentralizedApp').and.callThrough();
+    component.getRolesForSelectedCentralizedApp('Test');
+    expect(component.getRolesForSelectedCentralizedApp).toHaveBeenCalledWith('Test');
+  });
+
+  
+
+  
+
+  
 });
index 35f9b50..02ce3a8 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { SchedulerComponent } from './scheduler.component';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
+import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
+import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
 
 describe('SchedulerComponent', () => {
   let component: SchedulerComponent;
   let fixture: ComponentFixture<SchedulerComponent>;
+  const payload: any = {"widgetData":"widgetTestData"};
+  const policy = ["test1","test2","test3"];
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ SchedulerComponent ]
-    })
+      declarations: [ SchedulerComponent,InformationModalComponent,ConfirmationModalComponent ],
+      imports:[FormsModule,NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule,NgbModule.forRoot()],
+      providers:[NgbActiveModal]
+    }).overrideModule(BrowserDynamicTestingModule, { set: { entryComponents: [InformationModalComponent,ConfirmationModalComponent] } })
     .compileComponents();
   }));
 
   beforeEach(() => {
     fixture = TestBed.createComponent(SchedulerComponent);
     component = fixture.componentInstance;
+    component.payload =payload;
+    component.policys = policy;
+    component.schedulerObjConst.WorkflowName = "workFlowName";
+    component.schedulerObj.domainData=[{"WorkflowName":"test"}];
+   // component.schedulerObj.schedulingInfo.normalDurationInSeconds= 20;
+   component.vnfObject = {
+    workflow: null,
+    vnfNames:'test1'
+  };
+    component.schedulerObj.schedulingInfo = {
+      normalDurationInSeconds: '',
+      additionalDurationInSeconds: '',
+      concurrencyLimit: '',
+      policyId: '',
+      vnfDetails: [
+        {
+          groupId: "",
+          node: [],
+          changeWindow: [{
+            startTime: '',
+            endTime: ''
+          }]
+        }]
+      };
+    
+    // component.schedulerObj.schedulingInfo.additionalDurationInSeconds= null;
+    // component.schedulerObj.schedulingInfo.concurrencyLimit=null;
+    // component.schedulerObj.schedulingInfo['vnfDetails'][0].groupId=null;
+    // component.schedulerObj.schedulingInfo['vnfDetails'][0].node=null;
     fixture.detectChanges();
   });
 
   it('should create', () => {
     expect(component).toBeTruthy();
   });
+
+  it('radioSelections should return stubbed value', () => {
+    spyOn(component, 'radioSelections').and.callThrough();
+    component.schedulerForm.checkboxSelection = "true";
+    component.radioSelections();
+    expect(component.radioSelections).toHaveBeenCalledWith();
+  });
+
+  it('onChangeUpdatePolicyName should return stubbed value', () => {
+    spyOn(component, 'onChangeUpdatePolicyName').and.callThrough();
+    component.onChangeUpdatePolicyName("test1","test1");
+    expect(component.onChangeUpdatePolicyName).toHaveBeenCalledWith("test1","test1");
+  });
+
+  it('onChangeUpdateTimeUnit should return stubbed value', () => {
+    spyOn(component, 'onChangeUpdateTimeUnit').and.callThrough();
+    component.onChangeUpdateTimeUnit("HOURS","HOURS");
+    expect(component.onChangeUpdateTimeUnit).toHaveBeenCalledWith("HOURS","HOURS");
+  });
+  it('isDateValid should return stubbed value', () => {
+    spyOn(component, 'isDateValid').and.callThrough();
+    component.isDateValid("10/24/2020");
+    expect(component.isDateValid).toHaveBeenCalledWith("10/24/2020");
+  });
+  it('isStartDateValidFromToday should return stubbed value', () => {
+    spyOn(component, 'isStartDateValidFromToday').and.callThrough();
+    component.isStartDateValidFromToday("10/24/2020");
+    expect(component.isStartDateValidFromToday).toHaveBeenCalledWith("10/24/2020");
+    component.isStartDateValidFromToday("10/24/2021");
+    expect(component.isStartDateValidFromToday).toHaveBeenCalledWith("10/24/2021");
+  });
+
+  it('isToDateGreaterFromDate should return stubbed value', () => {
+    spyOn(component, 'isToDateGreaterFromDate').and.callThrough();
+    component.isToDateGreaterFromDate('10/24/2020','10/24/2021');
+    expect(component.isToDateGreaterFromDate).toHaveBeenCalledWith('10/24/2020','10/24/2021');
+    component.isToDateGreaterFromDate('10/24/2021','10/24/2020');
+    expect(component.isToDateGreaterFromDate).toHaveBeenCalledWith('10/24/2021','10/24/2020');
+  });
+
+  it('submit should return stubbed value', () => {
+    spyOn(component, 'submit').and.callThrough();
+    component.timeSlots = [{"startTime":"10/24/2021"}];
+    component.submit();
+    expect(component.submit).toHaveBeenCalledWith();
+  });
+
+  it('reject should return stubbed value', () => {
+    spyOn(component, 'reject').and.callThrough();
+    component.timeSlots = [{"startTime":"10/24/2021"}];
+    component.reject();
+    expect(component.reject).toHaveBeenCalledWith();
+  });
+
+  // it('sendSchedulerReq should return stubbed value', () => {
+  //   spyOn(component, 'sendSchedulerReq').and.callThrough();
+  //   component.timeSlots = [{"startTime":"10/24/2021"}];
+  //   component.sendSchedulerReq();
+  //   expect(component.sendSchedulerReq).toHaveBeenCalledWith();
+  // });
+  it('seviceCallToGetTimeSlots should return stubbed value', () => {
+    spyOn(component, 'seviceCallToGetTimeSlots').and.callThrough();
+    component.seviceCallToGetTimeSlots();
+    expect(component.seviceCallToGetTimeSlots).toHaveBeenCalledWith();
+  });
+
+  it('getPolicy should return stubbed value', () => {
+    spyOn(component, 'getPolicy').and.callThrough();
+    component.getPolicy();
+    expect(component.getPolicy).toHaveBeenCalledWith();
+  });
+
+  it('parseErrorMsg should return stubbed value', () => {
+    const response ={"entity":{"requestError":{"text":"EmptyTest"}}};
+    spyOn(component, 'parseErrorMsg').and.callThrough();
+    component.parseErrorMsg(response,"TestMethod");
+    expect(component.parseErrorMsg).toHaveBeenCalledWith(response,"TestMethod");
+  });
+
+  it('extractChangeManagementCallbackDataStr should return stubbed value', () => {
+    let response ={"workflow":"Update","vnfNames":[
+      {"availableVersions":[{"requestInfo":{"source":"URL","suppressRollback":"suppressRollback","requestorId":"requestorId"},"requestParameters":{"usePreload":2}}]},
+      {"availableVersions":[{"requestInfo":{"source":"URL","suppressRollback":"suppressRollback","requestorId":"requestorId"},"requestParameters":{"usePreload":2}}]}]};
+    spyOn(component, 'extractChangeManagementCallbackDataStr').and.callThrough();
+
+    component.extractChangeManagementCallbackDataStr(response);
+    expect(component.extractChangeManagementCallbackDataStr).toHaveBeenCalledWith(response);
+       response ={"workflow":"Replace","vnfNames":[
+      {"availableVersions":[{"requestInfo":{"source":"URL","suppressRollback":"suppressRollback","requestorId":"requestorId"},"requestParameters":{"usePreload":2}}]},
+      {"availableVersions":[{"requestInfo":{"source":"URL","suppressRollback":"suppressRollback","requestorId":"requestorId"},"requestParameters":{"usePreload":2}}]}]};
+    component.extractChangeManagementCallbackDataStr(response);
+    expect(component.extractChangeManagementCallbackDataStr).toHaveBeenCalledWith(response);
+    response ={"workflow":"VNF In Place Software Update","vnfNames":[
+      {"availableVersions":[{"requestInfo":{"source":"URL","suppressRollback":"suppressRollback","requestorId":"requestorId"},"requestParameters":{"usePreload":2}}]},
+      {"availableVersions":[{"requestInfo":{"source":"URL","suppressRollback":"suppressRollback","requestorId":"requestorId"},"requestParameters":{"usePreload":2}}]}]};
+    component.extractChangeManagementCallbackDataStr(response);
+    expect(component.extractChangeManagementCallbackDataStr).toHaveBeenCalledWith(response);
+    response ={"workflow":"VNF Config Update","vnfNames":[
+      {"availableVersions":[{"requestInfo":{"source":"URL","suppressRollback":"suppressRollback","requestorId":"requestorId"},"requestParameters":{"usePreload":2}}]},
+      {"availableVersions":[{"requestInfo":{"source":"URL","suppressRollback":"suppressRollback","requestorId":"requestorId"},"requestParameters":{"usePreload":2}}]}]};
+    component.extractChangeManagementCallbackDataStr(response);
+    expect(component.extractChangeManagementCallbackDataStr).toHaveBeenCalledWith(response);
+
+    response ={"workflow":"VNF In Place Software Update","vnfNames":[
+      {"availableVersions":[{"requestInfo":{"source":"URL","suppressRollback":"suppressRollback","requestorId":"requestorId"},"requestParameters":{"usePreload":2}}]},
+      {"availableVersions":[{"requestInfo":{"source":"URL","suppressRollback":"suppressRollback","requestorId":"requestorId"},"requestParameters":{"usePreload":2}}]}]};
+    component.extractChangeManagementCallbackDataStr(response);
+    expect(component.extractChangeManagementCallbackDataStr).toHaveBeenCalledWith(response);
+  });
+  it('formValidation should return stubbed value', () => {
+    spyOn(component, 'formValidation').and.callThrough();
+    component.formValidation();
+    expect(component.formValidation).toHaveBeenCalledWith();
+  });
+
+  it('convertToSecs should return stubbed value', () => {
+    spyOn(component, 'convertToSecs').and.callThrough();
+    component.convertToSecs(200);
+    expect(component.convertToSecs).toHaveBeenCalledWith(200);
+  });
+
+  it('stopPoll should return stubbed value', () => {
+    spyOn(component, 'stopPoll').and.callThrough();
+    component.stopPoll();
+    expect(component.stopPoll).toHaveBeenCalledWith();
+  });
+
+  it('getVnfData should return stubbed value', () => {
+    spyOn(component, 'getVnfData').and.callThrough();
+    component.getVnfData([{"name":"testName"}]);
+    expect(component.getVnfData).toHaveBeenCalledWith([{"name":"testName"}]);
+  });
+
+  it('openConfirmationModal should return stubbed value', () => {
+    spyOn(component, 'openConfirmationModal').and.callThrough();
+    component.openConfirmationModal("Test1","Test1");
+    expect(component.openConfirmationModal).toHaveBeenCalledWith("Test1","Test1");
+  });
+
+  it('openInformationModal should return stubbed value', () => {
+    spyOn(component, 'openInformationModal').and.callThrough();
+    component.openInformationModal("Test1","Test1");
+    expect(component.openInformationModal).toHaveBeenCalledWith("Test1","Test1");
+  });
+
+  
+
+  
+  
+
+  
+  
+  
+  
 });
index 142a0ba..cc32f24 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { NewNotificationModalComponent } from './new-notification-modal.component';
+import { FormsModule } from '@angular/forms';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
+import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
+import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
 
 describe('NewNotificationModalComponent', () => {
   let component: NewNotificationModalComponent;
+  let component1: NewNotificationModalComponent;
   let fixture: ComponentFixture<NewNotificationModalComponent>;
+  let fixture1: ComponentFixture<NewNotificationModalComponent>;
+  const selectedNotification ={"msgSource":"TestSource","priority":1,"startTime":"10/11/2020","endTime":"10/11/2021"}
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ NewNotificationModalComponent ]
-    })
+      declarations: [ NewNotificationModalComponent ,InformationModalComponent,ConfirmationModalComponent],
+      imports:[FormsModule,HttpClientTestingModule,NgMaterialModule,BrowserAnimationsModule,NgbModule.forRoot()],
+      providers:[NgbActiveModal]
+    }).overrideModule(BrowserDynamicTestingModule, { set: { entryComponents: [InformationModalComponent,ConfirmationModalComponent] } })
     .compileComponents();
   }));
 
@@ -55,9 +68,47 @@ describe('NewNotificationModalComponent', () => {
     fixture = TestBed.createComponent(NewNotificationModalComponent);
     component = fixture.componentInstance;
     fixture.detectChanges();
+
+
+    fixture1 = TestBed.createComponent(NewNotificationModalComponent);
+    component1 = fixture1.componentInstance;
+    component1.selectedNotification = selectedNotification;
+    fixture1.detectChanges();
+
+    
   });
 
   it('should create', () => {
     expect(component).toBeTruthy();
   });
+
+  it('addUserNotification should return stubbed value', () => {
+    spyOn(component1, 'addUserNotification').and.callThrough();
+    component1.addUserNotification();
+    expect(component1.addUserNotification).toHaveBeenCalledWith();
+  });
+
+  it('settingTreeParam should return stubbed value', () => {
+    spyOn(component1, 'settingTreeParam').and.callThrough();
+    component1.settingTreeParam();
+    expect(component1.settingTreeParam).toHaveBeenCalledWith();
+  });
+
+  it('checkTreeSelect should return stubbed value', () => {
+    spyOn(component1, 'checkTreeSelect').and.callThrough();
+    component1.checkTreeSelect();
+    expect(component1.checkTreeSelect).toHaveBeenCalledWith();
+  });
+
+  it('openConfirmationModal should return stubbed value', () => {
+    spyOn(component1, 'openConfirmationModal').and.callThrough();
+    component1.openConfirmationModal('Title','Message');
+    expect(component1.openConfirmationModal).toHaveBeenCalledWith('Title','Message');
+  });
+
+  it('openInformationModal should return stubbed value', () => {
+    spyOn(component1, 'openInformationModal').and.callThrough();
+    component1.openInformationModal('Title','Message');
+    expect(component1.openInformationModal).toHaveBeenCalledWith('Title','Message');
+  });
 });
index 82b4e12..0c82bb6 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { UserNotificationAdminComponent } from './user-notification-admin.component';
+import { FormsModule } from '@angular/forms';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('UserNotificationAdminComponent', () => {
   let component: UserNotificationAdminComponent;
@@ -46,7 +50,8 @@ describe('UserNotificationAdminComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ UserNotificationAdminComponent ]
+      declarations: [ UserNotificationAdminComponent ],
+      imports:[FormsModule,HttpClientTestingModule,NgMaterialModule,BrowserAnimationsModule]
     })
     .compileComponents();
   }));
index 05b04a9..b16dbc7 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { BulkUserComponent } from './bulk-user.component';
+import { FormsModule } from '@angular/forms';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 
 describe('BulkUserComponent', () => {
   let component: BulkUserComponent;
   let fixture: ComponentFixture<BulkUserComponent>;
+  const adminsAppsData:any =[{"titel":"TestDummyTitle"}];
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ BulkUserComponent ]
+      declarations: [ BulkUserComponent ],
+      imports:[FormsModule,HttpClientTestingModule,NgMaterialModule,BrowserAnimationsModule],
+      providers:[NgbActiveModal]
     })
     .compileComponents();
   }));
@@ -53,6 +61,7 @@ describe('BulkUserComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(BulkUserComponent);
     component = fixture.componentInstance;
+    component.adminsAppsData = adminsAppsData;
     fixture.detectChanges();
   });
 
index 60d024b..1041484 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { UsersComponent } from './users.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { NewUserModalComponent } from './new-user-modal/new-user-modal.component';
+import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
+import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
+import { BulkUserComponent } from './bulk-user/bulk-user.component';
+import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
+import { Component, Input } from '@angular/core';
 
 describe('UsersComponent', () => {
   let component: UsersComponent;
@@ -45,8 +55,9 @@ describe('UsersComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ UsersComponent ]
-    })
+      declarations: [ UsersComponent, NewUserModalComponent,BulkUserComponent,ConfirmationModalComponent,AppSearchUsersStubComponent,AppUsersdetailsFormStubComponent],
+      imports:[HttpClientTestingModule,FormsModule,NgMaterialModule,BrowserAnimationsModule,NgbModule.forRoot()]
+    }).overrideModule(BrowserDynamicTestingModule, { set: { entryComponents: [NewUserModalComponent,BulkUserComponent,ConfirmationModalComponent] } })
     .compileComponents();
   }));
 
@@ -59,4 +70,55 @@ describe('UsersComponent', () => {
   it('should create', () => {
     expect(component).toBeTruthy();
   });
+
+  it('openAddNewUserModal should return stubbed value', () => {
+    spyOn(component, 'openAddNewUserModal').and.callThrough();
+    component.openAddNewUserModal();
+    expect(component.openAddNewUserModal).toHaveBeenCalledWith();
+  });
+  it('openExistingUserModal should return stubbed value', () => {
+    spyOn(component, 'openExistingUserModal').and.callThrough();
+    let user ={"firstName":"FirstTestName","lastName":"LastTestName","orgUserId":""};
+    component.openExistingUserModal(user);
+    expect(component.openExistingUserModal).toHaveBeenCalledWith(user);
+  });
+
+  it('openBulkUserUploadModal should return stubbed value', () => {
+    spyOn(component, 'openBulkUserUploadModal').and.callThrough();
+    component.openBulkUserUploadModal();
+    expect(component.openBulkUserUploadModal).toHaveBeenCalledWith();
+  });
+  it('applyDropdownFilter should return stubbed value', () => {
+    spyOn(component, 'applyDropdownFilter').and.callThrough();
+    let _appValue= {"value":"select-application"};
+    component.applyDropdownFilter(_appValue);
+    expect(component.applyDropdownFilter).toHaveBeenCalledWith(_appValue);
+    _appValue= {"value":"Test"};
+    component.applyDropdownFilter(_appValue);
+    expect(component.applyDropdownFilter).toHaveBeenCalledWith(_appValue);
+  });
+  it('applyFilter should return stubbed value', () => {
+    spyOn(component, 'applyFilter').and.callThrough();
+    component.applyFilter("Test");
+    expect(component.applyFilter).toHaveBeenCalledWith("Test");
+  });
+  it('getAdminApps should return stubbed value', () => {
+    spyOn(component, 'getAdminApps').and.callThrough();
+    component.getAdminApps();
+    expect(component.getAdminApps).toHaveBeenCalledWith();
+  });
 });
+
+@Component({selector: 'app-search-users', template: ''})
+class AppSearchUsersStubComponent {
+@Input() searchTitle:any;
+@Input() isSystemUser:boolean;
+@Input() placeHolder:any;
+
+
+}
+@Component({selector: 'app-user-details-form', template: ''})
+class AppUsersdetailsFormStubComponent {
+
+}
+
index 4dc8572..95eb021 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { WebAnalyticsDetailsDialogComponent } from './web-analytics-details-dialog.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 
 describe('WebAnalyticsDetailsDialogComponent', () => {
   let component: WebAnalyticsDetailsDialogComponent;
   let fixture: ComponentFixture<WebAnalyticsDetailsDialogComponent>;
+  const userTableAppReport: any = {"appName":"WebNameTest"};
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ WebAnalyticsDetailsDialogComponent ]
+      declarations: [ WebAnalyticsDetailsDialogComponent ],
+      imports:[HttpClientTestingModule,FormsModule,NgMaterialModule,BrowserAnimationsModule],
+      providers:[NgbActiveModal]
     })
     .compileComponents();
   }));
@@ -54,6 +62,7 @@ describe('WebAnalyticsDetailsDialogComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(WebAnalyticsDetailsDialogComponent);
     component = fixture.componentInstance;
+    component.userTableAppReport = userTableAppReport;
     fixture.detectChanges();
   });
 
index 76d44cc..93fde8d 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { WebAnalyticsComponent } from './web-analytics.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('WebAnalyticsComponent', () => {
   let component: WebAnalyticsComponent;
@@ -46,7 +50,9 @@ describe('WebAnalyticsComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ WebAnalyticsComponent ]
+      declarations: [ WebAnalyticsComponent ],
+      imports:[HttpClientTestingModule,FormsModule,NgMaterialModule,BrowserAnimationsModule],
+
     })
     .compileComponents();
   }));
index 83de004..e44c7f8 100644 (file)
@@ -1,6 +1,13 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { WidgetCatalogComponent } from './widget-catalog.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { GridsterModule } from 'angular-gridster2';
+import { ElipsisPipe } from 'src/app/shared/pipes/elipsis/elipsis.pipe';
+import { Component, Input } from '@angular/core';
 
 describe('WidgetCatalogComponent', () => {
   let component: WidgetCatalogComponent;
@@ -8,7 +15,8 @@ describe('WidgetCatalogComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ WidgetCatalogComponent ]
+      declarations: [ WidgetCatalogComponent ,ElipsisPipe,AppDynamicWidgetStubComponent],
+      imports:[HttpClientTestingModule,FormsModule,NgMaterialModule,BrowserAnimationsModule,GridsterModule]
     })
     .compileComponents();
   }));
@@ -23,3 +31,8 @@ describe('WidgetCatalogComponent', () => {
     expect(component).toBeTruthy();
   });
 });
+
+@Component({selector: 'app-dynamic-widget', template: ''})
+class AppDynamicWidgetStubComponent { 
+  @Input() widgetType:any;
+}
index 411da1e..b2f3b4b 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { WidgetDetailsDialogComponent } from './widget-details-dialog.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { IWidget } from 'src/app/shared/model/widget-onboarding/widget';
 
 describe('WidgetDetailsDialogComponent', () => {
   let component: WidgetDetailsDialogComponent;
   let fixture: ComponentFixture<WidgetDetailsDialogComponent>;
+  const widget: IWidget = {"allUser":true,"name":"WidgetTestName"};
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ WidgetDetailsDialogComponent ]
+      declarations: [ WidgetDetailsDialogComponent ],
+      imports:[HttpClientTestingModule,FormsModule,ReactiveFormsModule,NgMaterialModule,BrowserAnimationsModule],
+      providers:[NgbActiveModal]
     })
     .compileComponents();
   }));
@@ -54,6 +63,7 @@ describe('WidgetDetailsDialogComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(WidgetDetailsDialogComponent);
     component = fixture.componentInstance;
+    component.widget=widget;
     fixture.detectChanges();
   });
 
index 2fd7ef2..e0df154 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { WidgetOnboardingComponent } from './widget-onboarding.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('WidgetOnboardingComponent', () => {
   let component: WidgetOnboardingComponent;
@@ -45,7 +49,8 @@ describe('WidgetOnboardingComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ WidgetOnboardingComponent ]
+      declarations: [ WidgetOnboardingComponent ],
+      imports:[HttpClientTestingModule,FormsModule,NgMaterialModule,BrowserAnimationsModule],
     })
     .compileComponents();
   }));
index 72982a1..f0aa97a 100644 (file)
@@ -1,6 +1,8 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { WidgetsComponent } from './widgets.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('WidgetsComponent', () => {
   let component: WidgetsComponent;
@@ -8,7 +10,8 @@ describe('WidgetsComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ WidgetsComponent ]
+      declarations: [ WidgetsComponent ],
+      imports:[HttpClientTestingModule,BrowserAnimationsModule]
     })
     .compileComponents();
   }));
index 22a477d..a553fb4 100644 (file)
 import { ElipsisPipe } from './elipsis.pipe';
 
 describe('ElipsisPipe', () => {
+  let pipe;
   it('create an instance', () => {
-    const pipe = new ElipsisPipe();
+     pipe = new ElipsisPipe();
     expect(pipe).toBeTruthy();
   });
+  it('removeImage should return stubbed value', () => {
+    spyOn(pipe, 'transform').and.callThrough();
+    pipe.transform('PipeTest','2');
+    expect(pipe.transform).toHaveBeenCalledWith('PipeTest','2');
+  });
 });
index d799193..6a36704 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { ListWidgetComponent } from './list-widget.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { FormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('ListWidgetComponent', () => {
   let component: ListWidgetComponent;
@@ -46,7 +50,9 @@ describe('ListWidgetComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ ListWidgetComponent ]
+      declarations: [ ListWidgetComponent ],
+      imports:[HttpClientTestingModule,FormsModule,NgMaterialModule,BrowserAnimationsModule]
+
     })
     .compileComponents();
   }));
index cc5810c..59802ba 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { PluginComponent } from './plugin.component';
+import { ClientPluginLoaderService } from './plugin-loader/client-plugin-loader.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('PluginComponent', () => {
   let component: PluginComponent;
   let fixture: ComponentFixture<PluginComponent>;
-
+  let clientPluginLoaderService: ClientPluginLoaderService;
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ PluginComponent ]
+      declarations: [ PluginComponent ],
+      providers:[ClientPluginLoaderService],
+      imports: [HttpClientTestingModule]
     })
     .compileComponents();
   }));
index b64ea7c..8c6202e 100644 (file)
@@ -44,6 +44,7 @@ import {
   ViewContainerRef
 } from '@angular/core';
 import { PluginLoaderService } from './plugin-loader/plugin-loader.service';
+import { ClientPluginLoaderService } from './plugin-loader/client-plugin-loader.service';
 
 @Component({
   selector: 'app-plugin',
@@ -55,7 +56,7 @@ export class PluginComponent implements OnInit {
 
   constructor(
     private injector: Injector,
-    private pluginLoader: PluginLoaderService
+    private pluginLoader: ClientPluginLoaderService
   ) {}
 
   ngOnInit() {
index ea61061..1d8a643 100644 (file)
@@ -1,12 +1,44 @@
 import { TestBed } from '@angular/core/testing';
 
 import { AdminsService } from './admins.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('AdminsService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  let service: AdminsService;
+  beforeEach(() => TestBed.configureTestingModule({
+    imports:[HttpClientTestingModule]
+  }));
 
   it('should be created', () => {
-    const service: AdminsService = TestBed.get(AdminsService);
+    service = TestBed.get(AdminsService);
     expect(service).toBeTruthy();
   });
+  it('getAdminAppsRoles should return stubbed value', () => {
+    spyOn(service, 'getAdminAppsRoles').and.callThrough();
+    service.getAdminAppsRoles("test");
+    expect(service.getAdminAppsRoles).toHaveBeenCalledWith("test");
+  });
+  it('getRolesByApp should return stubbed value', () => {
+    spyOn(service, 'getRolesByApp').and.callThrough();
+    service.getRolesByApp("test");
+    expect(service.getRolesByApp).toHaveBeenCalledWith("test");
+  });
+
+  it('updateAdminAppsRoles should return stubbed value', () => {
+    spyOn(service, 'updateAdminAppsRoles').and.callThrough();
+    service.updateAdminAppsRoles("test");
+    expect(service.updateAdminAppsRoles).toHaveBeenCalledWith("test");
+  });
+
+  it('isComplexPassword should return stubbed value', () => {
+    spyOn(service, 'isComplexPassword').and.callThrough();
+    service.isComplexPassword("testpassword");
+    expect(service.isComplexPassword).toHaveBeenCalledWith("testpassword");
+  });
+
+  it('addNewUser should return stubbed value', () => {
+    spyOn(service, 'addNewUser').and.callThrough();
+    service.addNewUser("testuser","duplicatecheck");
+    expect(service.addNewUser).toHaveBeenCalledWith("testuser","duplicatecheck");
+  });
 });
index 5f78986..92c0a72 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { ApplicationCatalogService } from './application-catalog.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('ApplicationCatalogService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: ApplicationCatalogService = TestBed.get(ApplicationCatalogService);
index 6801738..f4f36e3 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { ApplicationsService } from './applications.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('ApplicationsService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: ApplicationsService = TestBed.get(ApplicationsService);
index 4a6c0f4..72267b9 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { BasicAuthAccountService } from './basic-auth-account.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('BasicAuthAccountService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: BasicAuthAccountService = TestBed.get(BasicAuthAccountService);
index 03d55d0..3a91b52 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { ContactUsService } from './contact-us.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('ContactUsService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: ContactUsService = TestBed.get(ContactUsService);
     expect(service).toBeTruthy();
   });
+
+  it('addContactUs should return stubbed value', () => {
+    const service: ContactUsService = TestBed.get(ContactUsService);
+    spyOn(service, 'addContactUs').and.callThrough();
+    service.addContactUs("TEST");
+    expect(service.addContactUs).toHaveBeenCalledWith("TEST")  
+  });
+
+  it('modifyContactUs should return stubbed value', () => {
+    const service: ContactUsService = TestBed.get(ContactUsService);
+    spyOn(service, 'modifyContactUs').and.callThrough();
+    service.modifyContactUs("TEST");
+    expect(service.modifyContactUs).toHaveBeenCalledWith("TEST")  
+  });
+
+  it('removeContactUs should return stubbed value', () => {
+    const service: ContactUsService = TestBed.get(ContactUsService);
+    spyOn(service, 'removeContactUs').and.callThrough();
+    service.removeContactUs("TEST");
+    expect(service.removeContactUs).toHaveBeenCalledWith("TEST")  
+  });
 });
index d7f33e9..09de229 100644 (file)
@@ -1,9 +1,10 @@
 import { TestBed } from '@angular/core/testing';
 
 import { ExternalRequestAccessService } from './external-request-access.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('ExternalRequestAccessService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: ExternalRequestAccessService = TestBed.get(ExternalRequestAccessService);
index 1280c08..2908867 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { FunctionalMenuService } from './functional-menu.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+
 
 describe('FunctionalMenuService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({
+    imports:[HttpClientTestingModule]}
+    ));
 
   it('should be created', () => {
     const service: FunctionalMenuService = TestBed.get(FunctionalMenuService);
index 2f0c96a..f98d336 100644 (file)
@@ -1,9 +1,10 @@
 import { TestBed } from '@angular/core/testing';
 
 import { GetAccessService } from './get-access.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('GetAccessService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: GetAccessService = TestBed.get(GetAccessService);
index 50ccebb..4e384c1 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { GlobalSearchService } from './global-search.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('GlobalSearchService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: GlobalSearchService = TestBed.get(GlobalSearchService);
index a5ad81b..85e6e29 100644 (file)
@@ -1,9 +1,10 @@
 import { TestBed } from '@angular/core/testing';
 
 import { ManifestService } from './manifest.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('ManifestService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: ManifestService = TestBed.get(ManifestService);
index b624236..ad345d1 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { MenusService } from './menus.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('MenusService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: MenusService = TestBed.get(MenusService);
index 439a948..aa3229e 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { MicroserviceService } from './microservice.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('MicroserviceService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: MicroserviceService = TestBed.get(MicroserviceService);
index b8f0d33..fdaec24 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { NotificationService } from './notification.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('NotificationService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: NotificationService = TestBed.get(NotificationService);
index e984467..932d01e 100644 (file)
@@ -1,9 +1,10 @@
 import { TestBed } from '@angular/core/testing';
 
 import { PortalAdminsService } from './portal-admin.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('AdminsService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: PortalAdminsService = TestBed.get(PortalAdminsService);
index e593561..96802f8 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { RoleService } from './role.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('RoleService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: RoleService = TestBed.get(RoleService);
index dbeb9b6..a473acd 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { SchedulerService } from './scheduler.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('SchedulerService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: SchedulerService = TestBed.get(SchedulerService);
index 065e6e5..15fffb6 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { SidebarService } from './sidebar.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('SidenavService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: SidebarService = TestBed.get(SidebarService);
index 70ae804..55a7ba0 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { AddTabFunctionService } from './add-tab-function.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('AddTabFunctionService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: AddTabFunctionService = TestBed.get(AddTabFunctionService);
     expect(service).toBeTruthy();
   });
+
+  it('filter should return stubbed value', () => {
+    const service: AddTabFunctionService = TestBed.get(AddTabFunctionService);
+    spyOn(service, 'filter').and.callThrough();
+    service.filter("TEST");
+    expect(service.filter).toHaveBeenCalledWith("TEST")  
+  });
 });
index b1d5e6b..265ae40 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { UserProfileService } from './user-profile.service';
-
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { Observable } from 'rxjs';
+import 'rxjs/add/observable/of';
 describe('UserProfileService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  // set the value to return when the `getValue` spy is called.
+  const stubValue = 'stub value';
+  const NODE_CONFIG: Array<any> = [];
+  beforeEach(() => 
+  {
+  TestBed.configureTestingModule({imports:[HttpClientTestingModule]})
+  
+  }
+
+    );
 
   it('should be created', () => {
     const service: UserProfileService = TestBed.get(UserProfileService);
     expect(service).toBeTruthy();
   });
+
+  it('getUserAppRoles should return stubbed value', () => {
+    const service: UserProfileService = TestBed.get(UserProfileService);
+    spyOn(service, 'getUserAppRoles').and.callThrough();
+    service.getUserAppRoles("TEST");
+    expect(service.getUserAppRoles).toHaveBeenCalledWith("TEST")  
+  });
 });
index 2432962..924c85c 100644 (file)
@@ -1,9 +1,10 @@
 import { TestBed } from '@angular/core/testing';
 
 import { UserbarService } from './userbar.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('UserbarService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: UserbarService = TestBed.get(UserbarService);
index c1f41d8..cd30d99 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { UsersService } from './users.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('UsersService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: UsersService = TestBed.get(UsersService);
index 102bf3d..1d4d168 100644 (file)
@@ -1,9 +1,10 @@
 import { TestBed } from '@angular/core/testing';
 
 import { UtilsService } from './utils.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('UtilsService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: UtilsService = TestBed.get(UtilsService);
index 0c9b86b..45e0c5b 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { WebAnalyticsService } from './web-analytics.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('WebAnalyticsService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: WebAnalyticsService = TestBed.get(WebAnalyticsService);
index fb87e8b..bceef7c 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { WidgetCatalogService } from './widget-catalog.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('WidgetCatalogService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: WidgetCatalogService = TestBed.get(WidgetCatalogService);
index 90e5326..f7214a5 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { WidgetOnboardingService } from './widget-onboarding.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 
 describe('WidgetOnboardingService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
 
   it('should be created', () => {
     const service: WidgetOnboardingService = TestBed.get(WidgetOnboardingService);
index 265cab7..77cef69 100644 (file)
@@ -5,9 +5,10 @@
     "ng": "ng",
     "start": "ng serve --host www.portal.onap.org --port 8989 --open",
     "build": "ng build --prod --aot=false --build-optimizer=false",
-    "test": "ng test",
+    "test": "ng test --watch=false --code-coverage --browsers=ChromeHeadless",
     "lint": "ng lint",
-    "e2e": "ng e2e"
+    "e2e": "ng e2e",
+    "sonar": "sonar-scanner"
   },
   "private": true,
   "dependencies": {
@@ -65,6 +66,7 @@
     "karma-jasmine": "~1.1.2",
     "karma-jasmine-html-reporter": "^0.2.2",
     "protractor": "~5.4.0",
+    "sonar-scanner": "^3.1.0",
     "ts-node": "~7.0.0",
     "tslint": "~5.11.0",
     "typescript": "~3.1.6"
index 626addb..21bdd50 100644 (file)
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <skipnode>false</skipnode>
                <skipcopy>false</skipcopy>
+               <sonar.typescript.lcov.reportPaths>coverage/lcov.info</sonar.typescript.lcov.reportPaths>
+        <sonar.sources>src</sonar.sources>
+               <sonar.projectKey>portal-FE-os</sonar.projectKey>
+               <sonar.projectName>portal-FE-os</sonar.projectName> 
+               <sonar.exclusions>**/node_modules/**,**/*.spec.ts,**/*.module.ts,**/environment.prod.ts,**/*.js,**/main.ts,**/header-interceptor.ts,**/dynamic-widget.component.ts</sonar.exclusions>
+               <sonar.test.inclusions>**/*.spec.ts</sonar.test.inclusions>
+               <sonar.tests>src</sonar.tests>
+               <sonar.sourceEncoding>UTF-8</sonar.sourceEncoding>
        </properties>
 
        <build>
                                                        <arguments>install</arguments>
                                                </configuration>
                                        </execution>
+                                       
+                                       <execution>
+                                               <id>npm run test</id>
+                                               <goals>
+                                                       <goal>npm</goal>
+                                               </goals>
+
+                                               <phase>generate-resources</phase>
+
+                                               <configuration>
+                                                       <arguments>run-script test</arguments>
+                                               </configuration>
+                                       </execution>
 
                                        <execution>
                                                <id>npm build</id>
index afc476f..cd96a77 100644 (file)
@@ -34,7 +34,7 @@
  * ============LICENSE_END============================================
  *
  * 
- */s
+ */
 import { TestBed, async } from '@angular/core/testing';
 import { RouterTestingModule } from '@angular/router/testing';
 import { AppComponent } from './app.component';
@@ -56,17 +56,4 @@ describe('AppComponent', () => {
     const app = fixture.debugElement.componentInstance;
     expect(app).toBeTruthy();
   });
-
-  it(`should have as title 'portal-FE-os'`, () => {
-    const fixture = TestBed.createComponent(AppComponent);
-    const app = fixture.debugElement.componentInstance;
-    expect(app.title).toEqual('portal-FE-os');
-  });
-
-  it('should render title in a h1 tag', () => {
-    const fixture = TestBed.createComponent(AppComponent);
-    fixture.detectChanges();
-    const compiled = fixture.debugElement.nativeElement;
-    expect(compiled.querySelector('h1').textContent).toContain('Welcome to portal-FE-os!');
-  });
 });
index 0ea2762..629e5fa 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { ApplicationDetailsDialogComponent } from './application-details-dialog.component';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { FormsModule } from '@angular/forms';
+import { NgbActiveModal, NgbModal, NgbModule } from '@ng-bootstrap/ng-bootstrap';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { IApplications } from 'src/app/shared/model/applications-onboarding/applications';
+import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
+import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
+import { NgbModalBackdrop } from '@ng-bootstrap/ng-bootstrap/modal/modal-backdrop';
+import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
+
 
 describe('ApplicationDetailsDialogComponent', () => {
   let component: ApplicationDetailsDialogComponent;
   let fixture: ComponentFixture<ApplicationDetailsDialogComponent>;
+  const applicationObj: IApplications = {"id":"testID"};
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ ApplicationDetailsDialogComponent ]
-    })
+      declarations: [ ApplicationDetailsDialogComponent,InformationModalComponent,ConfirmationModalComponent],
+      imports: [NgMaterialModule,FormsModule,HttpClientTestingModule,NgbModule.forRoot()],
+      providers: [NgbActiveModal]  
+    }).overrideModule(BrowserDynamicTestingModule, { set: { entryComponents: [InformationModalComponent,ConfirmationModalComponent] } })
     .compileComponents();
   }));
 
   beforeEach(() => {
     fixture = TestBed.createComponent(ApplicationDetailsDialogComponent);
     component = fixture.componentInstance;
+    component.applicationObj = applicationObj;
     fixture.detectChanges();
   });
 
   it('should create', () => {
     expect(component).toBeTruthy();
   });
+  it('removeImage should return stubbed value', () => {
+    spyOn(component, 'removeImage').and.callThrough();
+    component.removeImage();
+    expect(component.removeImage).toHaveBeenCalledWith();
+  });
+  it('saveChanges should return stubbed value', () => {
+    component.applicationObj.isCentralAuth = true;
+    component.applicationObj.isEnabled = false;
+    spyOn(component, 'saveChanges').and.callThrough();
+    component.saveChanges();
+    expect(component.saveChanges).toHaveBeenCalledWith();
+    component.applicationObj.isEnabled = true;
+    component.applicationObj.url = 'www.test.com'
+    component.applicationObj.restrictedApp =true;
+    
+    //spyOn(component, 'saveChanges').and.callThrough();
+    component.saveChanges();
+    expect(component.saveChanges).toHaveBeenCalledWith();
+    component.applicationObj.isCentralAuth = false;
+    component.applicationObj.url = 'test'
+    component.applicationObj.restrictedApp =false;
+    component.applicationObj.isOpen = true;
+    component.isEditMode =true;
+    //spyOn(component, 'saveChanges').and.callThrough();
+    component.saveChanges();
+    expect(component.saveChanges).toHaveBeenCalledWith();
+  });
+  it('saveChanges Central Auth is disabled', () => {
+    component.applicationObj.isCentralAuth = false;
+    component.applicationObj.isEnabled = false;
+    spyOn(component, 'saveChanges').and.callThrough();
+    component.saveChanges();
+    expect(component.saveChanges).toHaveBeenCalledWith();
+    component.applicationObj.isEnabled = true;
+    component.applicationObj.restrictedApp = true;
+    component.saveChanges();
+    expect(component.saveChanges).toHaveBeenCalledWith();
+    
+  });
+
+  it('saveChanges URL validation changes', () => {
+    component.applicationObj.isCentralAuth = true;
+    component.applicationObj.isEnabled = true;
+    component.applicationObj.name ='test';
+    component.applicationObj.url = 'https://www.test.com'
+    component.applicationObj.username ='test'
+    component.applicationObj.nameSpace ='ONAP'
+    spyOn(component, 'saveChanges').and.callThrough();
+    component.saveChanges();
+    expect(component.saveChanges).toHaveBeenCalledWith();
+    component.applicationObj.restrictedApp = false;
+    component.isEditMode = true;
+    component.saveChanges();
+    expect(component.saveChanges).toHaveBeenCalledWith();
+  });
 });
index 6065446..39d2ffd 100644 (file)
  *
  */
 
-import { Component, OnInit, Input, Output, EventEmitter} from '@angular/core';
+import { Component, OnInit, Input, Output, EventEmitter, PLATFORM_ID, Inject, Injector} from '@angular/core';
 import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
 import { IApplications } from 'src/app/shared/model/applications-onboarding/applications';
 import { ApplicationsService } from 'src/app/shared/services';
 import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
 import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
+import { isPlatformBrowser } from '@angular/common';
 
 @Component({
   selector: 'app-application-details-dialog',
@@ -59,9 +60,15 @@ export class ApplicationDetailsDialogComponent implements OnInit {
   isSaving: boolean = false;
   originalImage: any;
   ECOMP_URL_REGEX = "/^((?:https?\:\/\/|ftp?\:\/\/)?(w{3}.)?(?:[-a-z0-9]+\.)*[-a-z0-9]+.*)[^-_.]$/i";
+  private ngbModal:NgbModal;
 
-  constructor(public activeModal: NgbActiveModal, public ngbModal: NgbModal,
-    public applicationsService : ApplicationsService) { }
+  constructor(public activeModal: NgbActiveModal,
+    public applicationsService : ApplicationsService,@Inject(PLATFORM_ID)private platformId:Object,private injector:Injector) {
+      if(isPlatformBrowser(this.platformId))
+      {
+        this.ngbModal = this.injector.get(NgbModal);
+      }
+     }
 
   @Input() applicationObj: IApplications;
   @Output() passEntry: EventEmitter<any> = new EventEmitter();
index 8e19838..3f75099 100644 (file)
@@ -39,6 +39,9 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { ApplicationOnboardingComponent } from './application-onboarding.component';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 describe('ApplicationOnboardingComponent', () => {
   let component: ApplicationOnboardingComponent;
@@ -46,7 +49,8 @@ describe('ApplicationOnboardingComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ ApplicationOnboardingComponent ]
+      declarations: [ ApplicationOnboardingComponent ],
+      imports: [NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule]
     })
     .compileComponents();
   }));
index 1bef834..25383aa 100644 (file)
@@ -38,6 +38,7 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { PagesComponent } from './pages.component';
+import { Component } from '@angular/core';
 
 describe('PagesComponent', () => {
   let component: PagesComponent;
@@ -45,7 +46,7 @@ describe('PagesComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ PagesComponent ]
+      declarations: [ PagesComponent,RouterOutletStubComponent ]
     })
     .compileComponents();
   }));
@@ -60,3 +61,6 @@ describe('PagesComponent', () => {
     expect(component).toBeTruthy();
   });
 });
+
+@Component({selector: 'router-outlet', template: ''})
+class RouterOutletStubComponent { }
index beb998c..85a2d9e 100644 (file)
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { NewUserModalComponent } from './new-user-modal.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { Component, Input } from '@angular/core';
+import { FormsModule } from '@angular/forms';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { MatRadioChange } from '@angular/material';
 
 describe('NewUserModalComponent', () => {
   let component: NewUserModalComponent;
@@ -45,7 +52,9 @@ describe('NewUserModalComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ NewUserModalComponent ]
+      declarations: [ NewUserModalComponent,AppSearchUsersStubComponent,AppUserdetailsFormStubComponent ],
+      imports:[HttpClientTestingModule,FormsModule,NgMaterialModule,BrowserAnimationsModule],
+      providers:[NgbActiveModal]
     })
     .compileComponents();
   }));
@@ -59,4 +68,67 @@ describe('NewUserModalComponent', () => {
   it('should create', () => {
     expect(component).toBeTruthy();
   });
+
+  it('addNewUser should return stubbed value', () => {
+    spyOn(component, 'addNewUser').and.callThrough();
+    component.addNewUser(true);
+    expect(component.addNewUser).toHaveBeenCalledWith(true);
+  });
+
+  it('changeSelectedUser should return stubbed value', () => {
+    spyOn(component, 'changeSelectedUser').and.callThrough();
+    let user = {};
+    component.changeSelectedUser(user);
+    expect(component.changeSelectedUser).toHaveBeenCalledWith(user);
+    user = {"firstName":"FirstTestName","lastName":"LastTestName","orgUserId":"TestOrgId"};
+    component.changeSelectedUser(user);
+    expect(component.changeSelectedUser).toHaveBeenCalledWith(user);
+
+  });
+
+  // it('searchUserRadioChange should return stubbed value', () => {
+  //   spyOn(component, 'searchUserRadioChange').and.callThrough();
+  //   MatRadio = {"value":""};
+  //   component.searchUserRadioChange(eventCheck);
+  //   expect(component.searchUserRadioChange).toHaveBeenCalledWith(event);
+  //   event = {"value":"System"};
+  //   component.searchUserRadioChange(event);
+  //   expect(component.searchUserRadioChange).toHaveBeenCalledWith(event);
+
+  // });
+
+  it('navigateBack should return stubbed value', () => {
+    spyOn(component, 'navigateBack').and.callThrough();
+    component.navigateBack();
+    expect(component.navigateBack).toHaveBeenCalledWith();
+  });
+
+  it('roleSelectChange should return stubbed value', () => {
+    spyOn(component, 'roleSelectChange').and.callThrough();
+    let element = {"id":2};
+    component.roleSelectChange(element);
+    expect(component.roleSelectChange).toHaveBeenCalledWith(element);
+  });
+
+  it('getUserAppsRoles should return stubbed value', () => {
+    spyOn(component, 'getUserAppsRoles').and.callThrough();
+    component.changedSelectedUser = 'Test';
+    component.getUserAppsRoles();
+    expect(component.getUserAppsRoles).toHaveBeenCalledWith();
+  });
+  
+
+  
 });
+
+@Component({selector: 'app-search-users', template: ''})
+class AppSearchUsersStubComponent { 
+  @Input() searchTitle:any;
+  @Input() isSystemUser:any;
+  @Input() placeHolder:any;
+}
+
+@Component({selector: 'app-user-details-form', template: ''})
+class AppUserdetailsFormStubComponent { 
+  
+}
index 3262174..b687cd5 100644 (file)
@@ -1,6 +1,11 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { UserDetailsFormComponent } from './user-details-form.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { NgMaterialModule } from 'src/app/ng-material-module';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 
 describe('UserDetailsFormComponent', () => {
   let component: UserDetailsFormComponent;
@@ -8,7 +13,9 @@ describe('UserDetailsFormComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ UserDetailsFormComponent ]
+      declarations: [ UserDetailsFormComponent ],
+      imports:[HttpClientTestingModule,FormsModule,ReactiveFormsModule,NgMaterialModule,BrowserAnimationsModule],
+      providers:[NgbActiveModal]
     })
     .compileComponents();
   }));
diff --git a/portal-FE-os/src/testing/router-link-directive-stub.ts b/portal-FE-os/src/testing/router-link-directive-stub.ts
new file mode 100644 (file)
index 0000000..73e75cb
--- /dev/null
@@ -0,0 +1,14 @@
+import { Directive, Input, HostListener } from "@angular/core";
+
+@Directive({
+    selector: '[routerLink]'
+  })
+  export class RouterLinkDirectiveStub {
+    @Input('routerLink') linkParams: any;
+    navigatedTo: any = null;
+  
+    @HostListener('click')
+    onClick() {
+      this.navigatedTo = this.linkParams;
+    }
+  }
\ No newline at end of file