score:4

Accepted answer

Unless I am missing something, I think this is pretty straightforward. You don't want to unit test someone else's code (in this case chart.js), so you might simply want to determine if chart.chart.update() is being called within chart service. I would set up a spy for this, something like the following:

it('updateChartWith() should call chart.update()', () => {
    chartSpy = jasmine.createSpyObj({ update: null });
    chartMock = {chart: chartSpy};
    service.updateChartWith(chartMock);
    expect(chartSpy.update).toHaveBeenCalled();
});

Related Query

More Query from same tag