import 'reflect-metadata'; import { requiredMocks, } from './../../../test-mocks'; requiredMocks(jest); import { DisableScrollingService, } from './../../helpers/services/index'; import { ModalComponent, } from './modal.component'; const initModalComponent = ( disableScrollingService?: DisableScrollingService, ) => { return new ModalComponent( disableScrollingService, ); }; describe('ngOnInit', () => { // tslint:disable-next-line test('It calls disabledScrollingService.disableScrolling', () => { const disableScrollingService = {} as DisableScrollingService; disableScrollingService.disableScrolling = jest.fn(); const modalComponent = initModalComponent( disableScrollingService, ); modalComponent.ngOnInit(); expect( disableScrollingService.disableScrolling, ).toHaveBeenCalled(); }); }); describe('ngOnDestroy', () => { // tslint:disable-next-line test('It calls disabledScrollingService.enableScolling', () => { const disableScrollingService = {} as DisableScrollingService; disableScrollingService.enableScrolling = jest.fn(); const modalComponent = initModalComponent( disableScrollingService, ); modalComponent.ngOnDestroy(); expect( disableScrollingService.enableScrolling, ).toHaveBeenCalled(); }); });