`Hi All, I am stuck in writing a unit test for the below function in Angular. Here is my unit test: describe('ProductAccountSetupComponent', () => { let urlsService: GBUrlsService; let componentRefInstanceSpy: any; let component: ProductAccountSetupComponent; let fixture: ComponentFixture<ProductAccountSetupComponent>; beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [ProductAccountSetupComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA], providers: [ { provide: GBDataStore, useValue: dataStore }, { provide: GBRouterService, useValue: routerService }, { provide: GBAccountService, useValue: new MockAccountService() }, { provide: GBRoutes, useValue: {} }, { provide: GBTridionService, useValue: {} }, { provide: GBUrlsService, useValue: mockUrlsService }, { provide: GBOfferService, useValue: mockOfferService } ], }).compileComponents(); componentRefInstanceSpy = { cancel: { subscribe: jest.fn() } }; fixture.detectChanges(); }); describe('#initAccountSetup', () => { it('should create ZeroUnlinkedGoalsComponent and subscribe to cancel', () => { jest.spyOn(component, 'create'); const spy = jest.spyOn(component, 'reset'); componentRefInstanceSpy.cancel.subscribe.mockImplementationOnce((callback) => { callback(); }); fixture.detectChanges(); component.initZeroUnlinkedTemplate(); expect(spy).toHaveBeenCalled(); }); }); }); I get error: Parameter 'callback' implicitly has an 'any' type. I tried to mock componentRef but get error. I am trying to accomplish fixing the above error. Continue reading...