I have a very simple controller that looks like this.
timeInOut.controller('timeInOutController', function($scope, $filter, $ionicScrollDelegate){ ... });
Whenever I try to create a unit test for it like this ...
(function() { 'use strict'; var scope, controller, filter; describe('timeInOutController', function () { beforeEach(module('common.directives.kmDateToday')); beforeEach(inject(function ($rootScope, $controller, $filter) { scope = $rootScope.$new(); filter = $filter; controller = $controller('timeInOutController', { $scope: scope }); })); describe('#date setting', function(){ ... }); }); })();
I get an error message:
[$ injector: unpr] Unknown provider: $ ionicScrollDelegateProvider <- $ ionicScrollDelegate
Obviously, in my example here I am not trying to insert $ionicScrollDelegate into the test, because I tried this with any number of methods without success and I donβt know what unsuccessful attempt to include.
Also in my karma.conf.js file I include the ionic.bundle.js and angular-mocks.js .
I can successfully unit test something that does not use anything in it, and therefore I know that my test environment is configured correctly, the problem is that it injects everything related to the ion exchanger.
Hoser source share