I have following error during simple unit test in Angular/Jasmine/Karma.
TypeError: this.errorDialog.close is not a function
I have viewchild with close function. I would like to test close method.
TEST:
it('closeErrorDialog',()=>{
spyOn(component,'closeErrorDialog').and.callThrough();
component.closeErrorDialog();
});
Tested Method:
@ViewChild('errorDialog') errorDialog: any;
closeErrorDialog() {
this.errorDialog.close();
}
<custom-modal #errorDialog>
<button style="margin-right: 300px;" id="clsbtn" custom-button data-kind="primary"
(click)="closeError409Dialog()">clsoe</button>
</custom-modal>```
Could i ask you to help me or give me link to article or anything what can be helpful?