Closed caninojories closed 9 years ago
im using the sample in the hottowel test of john papa /* jshint -W117, -W030 */ 'use strict'; describe('main route', function () { describe('state', function () { var controller; var view = '/client/main/index.html';
beforeEach(function() {
module('app.main', bard.fakeToastr);
bard.inject('$httpBackend', '$location', '$rootScope', '$state', '$templateCache');
});
beforeEach(function() {
$templateCache.put(view, '');
});
it('should map state admin to url /admin ', function() {
expect($state.href('main', {})).to.equal('/');
});
it('should map /admin route to admin View template', function () {
expect($state.get('main').templateUrl).to.equal(view);
});
it('of admin should work with $state.go', function () {
$state.go('main');
$rootScope.$apply();
expect($state.is('main'));
});
});
});
this is my route (function() { 'use strict';
angular .module('app.main') .run(appRun);
appRun.$inject = ['routerHelper'];
/*ngInject*/
function appRun(routerHelper) {
routerHelper.configureRoutes(getRoutes());
}
function getRoutes() {
return [{
state: 'main',
config: {
url: '/',
templateUrl: '/client/main/index.html',
controller: 'Main as vm',
title: 'Main'
}
}];
}
}());
Doesn't look like a bard problem. Are you sure the routerHelper.js file is picked up by your test harness? That is NOT the same thing as being sure it is picked up when the app runs.
sorry.. i forgot to inject my dependency(app.core) in my admin module.. thanks for the answer..
what did you do to inject your dependency I am having the same issue - the dependency seems to be there in the module I am using though!
this is the error: Error: [$injector:unpr] Unknown provider: routerHelperProvider <- routerHelper