summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorraine Welch <lb2391@att.com>2020-03-04 16:15:34 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-04 16:15:34 +0000
commitc609ff2416224308262435b5d551700ef5f264d0 (patch)
tree894cb1911b685ba9b1ece2b2e781b59df900e019
parente7c531d9cd8484a01c6d74218d44a6f654544f68 (diff)
parentc72ca8d31fa744c9a02a215072d42db1156c82ec (diff)
Merge "test cases for log component"
-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();
+ })
});