When testing an angular controller that utilizes an external library like Google Analytics event tracking, how can you approach it? For instance:
$scope.showVolumn = function() {
ga('send', {
'hitType': 'event',
'eventCategory': 'Volume',
'eventAction': 'click',
'eventLabel': 'Interaction'
});
if($scope.native !== 'true')
vm.showVolumnCtl = !vm.showVolumnCtl;
};
While running my test code, I encountered this error:
ReferenceError: Can't find variable: ga
Is it possible to inject 'ga' in the beforeEach method for testing purposes?