I would like to do Unit Testing for Mat Open Dialog. The dialog opens when clicked on the button in the main page, the code for dialog is also in the same page(not injected). I am also using Mockito(not Jest) . New to unit testing , so need help.FOllowing the the test code. Tests passes but saying SPEC HAS NO EXPECTATIONS should call openDialog
{
provide: MAT_DIALOG_DATA,
useValue: {}
},
{ provide: MatDialogRef,
useValue: {}
}
it('should call openDialog', () => {
const fixture = TestBed.createComponent(abcComponent);
const app = fixture.componentInstance;
app.openDialog();
})
you need to add expectation of test. example:
in your case
But I suggest you have to unit test every function.