我有一家工厂,我试图在Jasmine进行测试。它看起来像这样:
angular.module('myApp').factory("TestObject", function() {
function TestObject(name,description) {
this.name = name;
this.description = description;
}
return TestObject;
});
我想用Jasmine测试它,所以我正在尝试:
describe('Factory: TestObject', function() {
beforeEach(function () {
module('myApp');
inject(function ($injector) {
testObject = $injector.get('TestObject');
});
});
});
我的问题是:当我需要将参数发送到工厂构造函数时,如何使用$ injector.get?
谢谢! URI