1
我有以下模块:如何测试模块中的常量?
angular.module('config', []).constant('myconstant', somevalue);
我想单元测试这使我产生:
describe('Constants', function() {
var config;
beforeEach(inject(function (_config_) {
module('config');
config =_config_;
}));
it('should return settings',function(){
expect(config.constant('myConstant')).toEqual('somevalue');
});
});
现在得到一个错误:
Error: [$injector:unpr] Unknown provider: configProvider <- config
我怎样才能解决这个问题?
这是一个常数......它应该有零行为,它不应该改变。你为什么要测试它?这似乎是错误的地方集中您的测试工作。 –
你的权利家伙我在想什么 – Leeuwtje