Anele Ngqandu

Anele Ngqandu

  • 1.3k
  • 430
  • 28.6k

Angular Testing error issues

Feb 15 2018 2:32 AM
Hi
  
Trying to test a function Visible that was written by someone and am getting error: TS2322 Type 'true' is not assignable to type ''COCTRefundHeadingLogic'
 
 Below is the class
  1. export class COCTRefundHeadingLogic extends Logic {  
  2.   
  3.     visible = (store: RequestStore): boolean => {  
  4.        
  5.   
  6.         let storeCouncil: Council = store.getValue([GeneralFieldKeys.GeneralCouncil]);  
  7.   
  8.         if (storeCouncil != "CPT")  
  9.             return false;  
  10.       
  11.          
  12.         return true;  
  13.     }  
  14.   
  15.   
  16. }  
Below is the test
  1. describe('CoctRefund', () => {  
  2.      
  3.   let component: COCTRefundBuyersHeadingLogic ;  
  4. beforeEach(() => {  
  5.     component  = new COCTRefundBuyersHeadingLogic(null);//Not sure what to do here  
  6. });  
  7.     it('should be visibly true', () => {  
  8.   
  9.       expect(component.visible).toEqual(true);  
  10.     });  
  11.   
  12.   });

Answers (1)