I am using angularjs and my controller is as follows:
(function (app) {
var myController = function ($scope, myService) {
var onData = function (response) {
if (!response.data || response.data.length === 0) {
app.showErrorMessage('Error');
} else {
$scope.myData = response.data;
drawChart();
}
$scope.loading = false;
};
var init = function () {
$scope.loading = true;
myService.getContBreakdown().then(onData, onError);
};
var drawChart = function () {
};
init();
};
app.controller('myController', ['$scope', 'myService', myController]);
}(angular.module('app')));
I am writing a jasmine test suit to check the data received from myService and make fun of the call to the drawChart () method. How to write a simple jasmine test costume to make fun of a call to the drawChart () method?
source
share