There is a class with dependencies, I can not understand how to test such things
import scrollTo from './scroll'; import {Renderer2, ElementRef } from '@angular/core'; import { IScrollData } from './scroll-data.interface'; export default class TabsExtension { constructor( private renderer: Renderer2, private el: ElementRef ) {} public configuration; private prevButton; private nextButton; private buttonsWrap; public init(wrap): void { this.generateButtons(); this.appendButtonsToParent(); this.addEventListeners(wrap); this.addTextToButtons(); this.addClassesToElements(); } private generateButtons() { this.prevButton = this.renderer.createElement('button'); this.nextButton = this.renderer.createElement('button'); this.buttonsWrap = this.renderer.createElement('div'); this.renderer.appendChild(this.buttonsWrap, this.prevButton); this.renderer.appendChild(this.buttonsWrap, this.nextButton); } private appendButtonsToParent() { const parent = this.el.nativeElement.parentNode; const refChild = this.el.nativeElement; this.renderer.insertBefore(parent, this.buttonsWrap, refChild); } private scrollElement(to, element) { const scrollData: IScrollData = { element, to, duration: this.configuration.scrollTime || 500, direction: this.configuration.direction }; scrollTo(scrollData); } private addEventListeners(wrapper): void { const scrollWidth = wrapper.nativeElement.scrollWidth; this.renderer.listen(this.prevButton, 'click', () => { this.scrollElement(-scrollWidth, wrapper.nativeElement); }); this.renderer.listen(this.nextButton, 'click', () => { this.scrollElement(scrollWidth, wrapper.nativeElement); }); } private addTextToButtons(): void { const prevText = this.renderer.createText(this.configuration.buttonPrevText || ''); const nextText = this.renderer.createText(this.configuration.buttonNextText || ''); this.renderer.appendChild(this.prevButton, prevText); this.renderer.appendChild(this.nextButton, nextText); } private addClassesToElements(): void { this.renderer.addClass(this.prevButton, this.configuration.buttonPrevClass || ''); this.renderer.addClass(this.nextButton, this.configuration.buttonNextClass || ''); this.renderer.addClass(this.buttonsWrap, this.configuration.buttonsWrapClass || ''); } }