title: Jasmine / Karma error as cannot read property of undefined
body: <p>I am trying to create cover all the line (Jasmine / Karma) but I am getting the error as <strong>Cannot read property 'search' of undefined</strong></p>
  <p>Here is my code for component code.</p>
  <pre><code>public search() {
    if (this.searchCompany.length) {
      let term = this.searchCompany;
      this.tempList = this.tempNameList.filter(tag =&gt; {
        if (tag.companyName.toLowerCase().indexOf(term.toLowerCase()) &gt; -1) {
          return tag;
        }
      });
    } else {
      this.resetCompanies();
    }
  }
  </code></pre>
  <p>Here is the below code for spec which I tried:</p>
  <pre><code>it('should search the data', () =&gt; {
    component.search;
    expect(component.search()).toBeUndefined();
  });
  </code></pre>
  <p>What I am doing wrong here?</p>