let component:MenusService;
let service:AdminService;
- var stubData={"data":{"active":"data2"}}
+ var stubData={"data":['{"active":"data"}','{"separator":"data1"}']};
beforeEach(() =>{
TestBed.configureTestingModule({
expect(component).toBeTruthy();
});
+ // it('should test getTotalRowCount method',()=>{
+ // component.getTotalRowCount();
+ // })
+
+ it('should test updateStatus method',()=>{
+ component['updateStatus']('N');
+ })
+
+ it('should test updateBooleanValue method',()=>{
+ component['updateBooleanValue'](true);
+ component['updateBooleanValue'](false);
+ })
+
+ it('should test updateParentNameToID method',()=>{
+ component.parentList=[{'name':'data'}];
+ component['updateParentNameToID']('data');
+ })
+
it('should test menu',()=>{
console.log(component.menu);
expect(component.menu.action).toEqual(null);
expect(spy).toHaveBeenCalled();
})
+
+ it('should test delete method',()=>{
+ let spy=spyOn(service,'deleteMenu').and.returnValue(Observable.of(""));
+ component.delete(stubData);
+ expect(spy).toHaveBeenCalled();
+ })
+
+ it('should test error part of delete method',()=>{
+ let spy=spyOn(service,'deleteMenu').and.returnValue(Observable.throw({status:404}));
+ component.delete(stubData);
+ expect(spy).toHaveBeenCalled();
+ })
+
+ it('should test getParentList method',()=>{
+ component.getParentList("getParentList");
+ expect(component.parentList).toEqual("getParentList");
+ })
+
+ it('should test get method',()=>{
+ let spy=spyOn(service,'getFnMenuItems').and.returnValue(Observable.of());
+ component.get();
+ expect(spy).toHaveBeenCalled();
+ })
});