3
我正在我的测试与人缘和幻影,我也正在使用摩卡和兴农和考验越来越失败,以下错误:“之前每一个”钩:workFn错误
EditResourceCategoryDialogTest EditResourceCategoryDialogController "before each" hook: workFn
Error: [$injector:modulerr] http://errors.angularjs.org/1.4.9/$injector/modulerr?p0=resourceofferingsApp&p1=Error%3A%20%5B%24injector%3Amodulerr%5D%20
示例代码:
define(function (require) {
"use strict";
var assert = require('chai').assert;
var sinon = require('sinon');
var angular = require('angular');
var angularMocks = require('angular.mocks');
require('resourceofferings/app');
require('dialog path');
describe('EditResourceCategoryDialogTest', function() {
beforeEach(module('resourceofferingsApp'));
describe('EditResourceCategoryDialogController', function() {
var $scope, ctrl;
//you need to inject dependencies first
beforeEach(inject(function ($rootScope, $injector) {
$scope = $rootScope.$new();
}));
it('initialization test (create mode)', inject(function ($controller) {
ctrl = $controller("EditResourceCategoryDialogController", {
$scope: $scope,
$uibModalInstance: null,
options: {
isEditMode: false
}
});
assert.equal($scope.isEditMode, false);
}));
});
});
});
其确切抵达该处失败:
beforeEach(inject(function ($rootScope, $injector) {
$scope = $rootScope.$new();
}));
请帮我解决这个问题..
在此先感谢。
谢谢史密斯。但是我仍然得到同样的错误:“每个钩子之前:workFn” –