I have an angular application and a method that gets provoked on click. In this method I am passing a value to another private method.
.ts file
public onViewItem(item: Results): void {
const ids = [item.data['id']];
this.anotherMethod(ids);
}
.spec file
it('should trigger a method on view item', () => {
component.onViewItem(documents[0]);
expect(component.onViewItem).toHaveBeenCalled();
});
How do I test the line const ids = [item.data['id']]; and check the call of this.anotherMethod(ids);