import { MatTableModule, MatSelectModule, MatSlideToggleModule } from '@angular/material';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { UserService } from 'src/app/shared/services/user/user.service';
+import { Observable } from 'rxjs';
describe('SelfComponent', () => {
let component: SelfComponent;
let fixture: ComponentFixture<SelfComponent>;
+ let userService:UserService;
+ let tableobj:any=JSON.stringify({"errormessage":"DummyError","stacktrace":"trace"});
beforeEach(async(() => {
TestBed.configureTestingModule({
fixture = TestBed.createComponent(SelfComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+ userService=TestBed.get(UserService);
});
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ describe('should test ngOnInit method',()=>{
+ it('should test subscribe',()=>{
+ let spy=spyOn(userService,'getFunctionalMenuStaticDetailSession').and.returnValue(Observable.of('you object'));
+ component.ngOnInit();
+ expect(spy).toHaveBeenCalled();
+ })
+ })
+
});