let component:RoleFunctionsService;
let service:AdminService;
- var stubData={"data":{"active":"data2"}}
+ //var stubData=['{"data":'{"active":"data2"}'}']
+ //var stubData1='{stubData}'
beforeEach(() =>{
TestBed.configureTestingModule({
expect(spy).toHaveBeenCalled();
})
+ it('should test error part of update method',()=>{
+ let spy=spyOn(service,'saveRoleFunction').and.returnValue(Observable.throw({status:404}));
+ component.update("data");
+ expect(spy).toHaveBeenCalled();
+})
+
it('should test delete method',()=>{
let spy=spyOn(service,'deleteRoleFunction').and.returnValue(Observable.of('your object'));
expect(spy).toHaveBeenCalled();
})
+ it('should test get method',()=>{
+ let spy=spyOn(service,'getRoleFunctionList').and.returnValue(Observable.of())
+ component.get();
+ expect(spy).toHaveBeenCalled();
+ })
});
\ No newline at end of file
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { UserService } from 'src/app/shared/services/user/user.service';
import { Observable } from 'rxjs';
-import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
+import { NgbModule, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap';
import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
+import { NewRoleComponent } from './new-role/new-role.component';
describe('RolesComponent', () => {
let component: RolesComponent;
// it('should test openAdoleModaldNewR method',()=>{
// component.openAdoleModaldNewR('dummydata2')
// })
+
+ it('should test openAdoleModaldNewR method',()=>{
+ component.toggleRole("")
+ })
+
+ it('should test getDismissReason method',()=>{
+ component['getDismissReason'](ModalDismissReasons.ESC);
+ component['getDismissReason'](ModalDismissReasons.BACKDROP_CLICK);
+ component['getDismissReason']("");
+ })
+
+ // it('should test applyFilter method',()=>{
+ // component.applyFilter("filterValue T");
+ // expect(component.dataSource.filter).toEqual("filtervalue");
+ // })
+
});
import { Observable } from 'rxjs';
import { ActivatedRoute } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
+import { ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap';
describe('SelfComponent', () => {
let component: SelfComponent;
})
})
+ it('should test getDismissReason method',()=>{
+ component['getDismissReason'](ModalDismissReasons.ESC);
+ component['getDismissReason'](ModalDismissReasons.BACKDROP_CLICK);
+ component['getDismissReason']("");
+ })
+
});