Facing issue to write Unit test case for IonModal

I am trying to cover one of my method of component in that I am dismissing modal on close button click

dismissModal() {
    this.modal.dismiss();
}

To cover above code in code-coverage I written below test case

it('should dismiss loading overlay', waitForAsync(() => {
    let modalCtrl = fixture.debugElement.injector.get(ModalController);
    spyOn(modalCtrl, 'dismiss');
    fixture.detectChanges();
    console.log(modalCtrl,component.modal);
    component.dismissModal();
    expect(modalCtrl.dismiss).toHaveBeenCalled();
  }));

But its throwing below error and my test case got failed.

Error:

Chrome 107.0.0.0 (Mac OS 10.15.7) DistributionWhatsNewPage should dismiss loading overlay FAILED
        Failed: Cannot read properties of undefined (reading 'dismiss')
        TypeError: Cannot read properties of undefined (reading 'dismiss')

Can anyone guide me on this whats wrong in above code?