summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.spec.ts')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.spec.ts73
1 files changed, 73 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.spec.ts
new file mode 100644
index 00000000..01ec7a92
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.spec.ts
@@ -0,0 +1,73 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { CacheAdminComponent } from './cache-admin.component';
+import { MatExpansionModule } from '@angular/material';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { AdminService } from '../admin.service';
+import { Observable } from 'rxjs/Observable';
+import 'rxjs/add/observable/of';
+import { CookieService } from 'ngx-cookie-service';
+import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
+import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
+import { SuccessModalComponent } from '../../modals/success-modal/success-modal.component';
+
+
+describe('CacheAdminComponent', () => {
+ let component: CacheAdminComponent;
+ let fixture: ComponentFixture<CacheAdminComponent>;
+ let adminService:AdminService;
+
+ var stubData1={"data":'{"data":"cachedRegions"}'};
+ var stubData2={"data":"stubData2"};
+
+ beforeEach(async(() => {
+
+ TestBed.configureTestingModule({
+ declarations: [
+ CacheAdminComponent,
+ SuccessModalComponent,
+ ],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ imports:[
+ MatExpansionModule,
+ HttpClientTestingModule,
+ NgbModule.forRoot()
+ ],
+ providers:[CookieService,AdminService],
+ })
+ TestBed.overrideModule(BrowserDynamicTestingModule,{
+ set:{
+ entryComponents:[SuccessModalComponent]
+ }
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(CacheAdminComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ adminService=TestBed.get(AdminService);
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+
+ describe('it should test ngOnInit method',()=>{
+ it('should test ngOnInit',()=>{
+ let spy=spyOn(adminService,'getCacheRegions').and.returnValue(Observable.of(stubData1));
+ component.ngOnInit();
+ expect(spy).toHaveBeenCalled();
+ })
+ })
+
+ it('it should test showRegionDetails method',()=>{
+ let spy=spyOn(adminService,'getCacheRegionDetails').and.returnValue(Observable.of(stubData2));
+ component.showRegionDetails("string");
+ expect(spy).toHaveBeenCalled();
+ })
+
+});
+