1
我想使用茉莉花的beforeAll而不是beforeEach,但angular.mock.module和angular.mock.inject函數不工作在beforeAll,而他們在之前工作。angular.mock.module和angular.mock.inject函數不工作在茉莉花的beforeAll
這是我的測試。 相同的代碼在beforeEach方法中工作。
describe("This is a test", function() {
beforeAll(module("app"));
var vm;
beforeAll(function() {
angular.mock.module(function ($provide) {
$provide.factory("dataService", ["$q", function ($q) {
return {
getSomeDataById: function() { return $q.resolve({ }); }
};
}]);
});
angular.mock.inject(function (_$controller_,dataService) {
vm = _$controller_("TestController",
{
dataService: dataService
});
});
});
});