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