I'm already using test case where I use $routeParams without a glicth but I can't make it work on this new test case.
Module
I reduce its content to the minimal
"use strict";
angular.module('warehousesModule', ['smart-table', 'services', 'ngRoute'])
.controller('WarehouseEditCtrl', [
'$scope', '$routeParams', '$location', '$window', 'API', 'gettextCatalog', 'form',
function ($scope, $routeParams, $location, $window, API, gettextCatalog, form) {
}]);
Unit test
"use strict";
describe('testModule', function () {
beforeEach(module('warehousesModule'));
describe('WarehouseEditCtrl', function () {
var $scope, ctrl, $httpBackend;
beforeEach(inject(function ($rootScope, $routeParams, $controller) {
$routeParams.compoundId = 3;
$scope = $rootScope.$new();
ctrl = $controller('WarehouseEditCtrl', {
$scope: $scope
});
}));
it('dummy', function () {
});
});
});
If I change the module and controller to another one (e.g. productsModule), it run without error.
Error message
Error: [$injector:unpr] Unknown provider: $routeParamsProvider <- $routeParams
http://ift.tt/1aUiwmF
at /home/elopez/projects/tcs_economat/frontend/static/js/vendor.min.js:1
at r (/home/elopez/projects/tcs_economat/frontend/static/js/vendor.min.js:1)
at /home/elopez/projects/tcs_economat/frontend/static/js/vendor.min.js:1
at r (/home/elopez/projects/tcs_economat/frontend/static/js/vendor.min.js:1)
at i (/home/elopez/projects/tcs_economat/frontend/static/js/vendor.min.js:1)
at workFn (/home/elopez/projects/tcs_economat/frontend/static_src/bower_components/angular-mocks/angular-mocks.js:2436)
undefined
Question
Both modules are in my main app, do you see what's the problem here ?
Aucun commentaire:
Enregistrer un commentaire