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」 –