是的,我对 Angular 和 Jasmine 完全陌生,我不知道如何为我的测试注入模拟 $log。这是测试:
(function () {
'use strict';
describe('basic test', function(){
it('should just work', function(){
var $log;
beforeEach(inject(function(_$log_){
$log = _$log_;
}));
$log.info('it worked!');
expect($log.info.logs).toContain(['it worked!']);
});
});
}())
这在注入行上失败并出现错误:
TypeError: Cannot set property 'typeName' of undefined
我错过了什么?