Ravindra P

Ravindra P

  • NA
  • 4
  • 460

Unit Test Simple Class with Parameter Constructor

May 15 2020 1:53 AM
Hi Team,
I have simple class with parameter construnctor and statics methods.
 
Class test {
static add( num1 , num2) : number
      {
            retrun num1 + num2;
      }
constructor(_id: number , _id2: number , _name: string , _endDate: Date ) {
   this.rid = _id;
   this.id2= _id2;
   this.name= _name;
   this.endDate = _endDate }
}
 
How can write unit test with jasmin karma i tried but getting issue while using method
describe('add test ' , () => {
it('should add numbers ', () => {
const result = model.add(1,2);
expect(result).toBe(3);
});
});
  
Issue :  "Property 'add' is a static member of type 'test'" 

Answers (3)