summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
authorIndrijeet kumar <indriku1@in.ibm.com>2020-03-04 20:29:56 +0530
committerIndrijeet kumar <indriku1@in.ibm.com>2020-03-04 20:30:05 +0530
commitc72ca8d31fa744c9a02a215072d42db1156c82ec (patch)
tree0e5ac6d7a1a0ab5eec28281ce17f3f6815c936b1 /ecomp-sdk
parentd1cb62e4628dcc6a445b48de9f618e50e25475f4 (diff)
test cases for log component
test cases for log component Issue-ID: PORTAL-813 Change-Id: Ieb84567bb45524d9edf677d6e00828b07970d580 Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts37
1 files changed, 36 insertions, 1 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts
index 250affed..e2b08a4f 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts
@@ -1,14 +1,28 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LogComponent } from './log.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { LogService } from './log.service';
+import { MockBackend } from '@angular/http/testing';
+import { BaseRequestOptions, Http } from '@angular/http';
+import 'rxjs/add/observable/of';
+import { Observable } from 'rxjs/Observable';
describe('LogComponent', () => {
let component: LogComponent;
let fixture: ComponentFixture<LogComponent>;
+ let logService:LogService;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ LogComponent ]
+ declarations: [ LogComponent ],
+ imports: [HttpClientTestingModule],
+ // providers:[LogService,MockBackend,BaseRequestOptions,{
+ // porvide:Http,useFactory:(backend:MockBackend,defaultOptions:BaseRequestOptions)=>{
+ // return new Http(backend,defaultOptions);
+ // },
+ // deps:[MockBackend,BaseRequestOptions],
+ // }]
})
.compileComponents();
}));
@@ -17,9 +31,30 @@ describe('LogComponent', () => {
fixture = TestBed.createComponent(LogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+ logService=TestBed.get(LogService);
});
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ describe('should test subscribe',()=>{
+ it('should test ngOnInit method1',()=>{
+ component.reportType = "Dashboard";
+ component.ngOnInit();
+ expect(component.stepNo).toEqual("3");
+ })
+ })
+
+ it('should test ngOnInit method2',()=>{
+ component.reportType != "Dashboard";
+ component.ngOnInit();
+ expect(component.stepNo).toEqual("7");
+ })
+
+ it('should test subscribe method inside ngOnInit method',()=>{
+ let spy=spyOn(logService,'getLogData').and.returnValue(Observable.of('you object'));
+ component.ngOnInit();
+ expect(spy).toHaveBeenCalled();
+ })
});