I have a Angular 4 app and I am using angular2-chartjs to plot charts in my application.
In the component, I have imported following:
import { ChartComponent } from 'angular2-chartjs';
import { ChartModule } from 'angular2-chartjs';
Created a chart property:
@ViewChild(ChartComponent) chart: ChartComponent;
Now I pass this chart object to a method of a service from the component:
this.chartService.updateChartWith(this.chart);
Now in chart service, I am updating the chart:
public updateChartWith(chart: ChartComponent) {
/** Some code **/
chart.chart.update();
}
Chart works perfectly. I want to write unit test for updateChartWith() method in Jasmine. How to write a unit test for chart.chart.update() line of code in Jasmine?