title: Unit test : Cannot read property 'toString' of undefined
body: <p>Below unit test is throwing error : TypeError: Cannot read property 'toString' of undefined. How can this be resolved?</p>
  
  <p>component.Ts code</p>
  
  <p>//Input value from parent</p>
  
  <pre><code>@Input() path: treeDataKey;
  ngOnInit() {
    this.getTestPlanData(this.testId);
    this.testPath = (this.path).toString().replace(/,/g,' /');
  }
  getTestPlanData(param:any) {
    //Do something
  }
  </code></pre>
  
  <p>component.spec.ts</p>
  
  <pre><code>it('should call getTestPlanData', () =&gt; {
      expect(component.getTestPlanData).toHaveBeenCalled;
  });
  </code></pre>