I have a DialogComponent that has the following constructor where Dialog is a custom object:
constructor(
public dialogRef: MatDialogRef
If you use at least one MatDialogRef
method, you should create a mock.
For example I use the close()
method. Without it errors would be generated so I made the below class with an empty method.
export class MatDialogRefMock {
close(value = '') {
}
}
and use that instead of an empty value, with useClass
{ provide: MatDialogRef, useClass: MatDialogRefMock },