title: "[object ErrorEvent]" thrown in angular app testing
body: <p>I want to test that my function is well called after button clicked. what is the best way to do it?</p>
  
  <p>I have this error with the flowing test</p>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>[object ErrorEvent] thrown
  </code></pre>
  
  <p><strong>My test spec:</strong></p>
  
  <pre><code>describe('myComponent', () =&gt; {
    beforeEach(() =&gt; {
      spyOn(component, 'myFunction');
      fixture.detectChanges();
    });
  
    it('Should test that myFunction is called when button clicked', () =&gt; {
       let params = "VALUE";
  
       let myBtn = fixture.debugElement.query(By.css('.item:nth-child(2) .delete'));
       myBtn.triggerEventHandler('click', null);
  
  
       expect(component.myFunction).toHaveBeenCalledWith(params);
    });
  });
  </code></pre>