我正在尝试为我的案例构建单元测试
我的控制器中有一些东西,比如
var factory = {};
factory.getDetail = function(name) {
//calculate…etc
return details;
}
return factory;
工厂档案
describe('controller', function () {
var testCtrl, scope, testFactory;
beforeEach(module('testApp'));
beforeEach(inject(function (_$controller_, _$rootScope_, _testFactory_) {
scope = _$rootScope_.$new();
testFactory = _testFactory_;
testCtrl = _$controller_('testCtrl', {
$scope: scope
});
};
var name = 'test';
spyOn(testFactory, 'getDetail').and.callFake(function(name) {
return 'success';
});
it('should get details', function() {
var result = testFactory.getDetail(name);
expect(result).toBeTruthy();
})
}));
单元测试文件
undefined' is not a function (evaluating 'testFactory.getDetail(name)' error.
我正在
ALTER TABLE MyTable ALTER COLUMN MyColumn columnType NULL
任何人都可以帮我解决这个问题吗?不知道出了什么问题。非常感谢!