私は次のコードを持っている:
angular.module('ps.workspaces').config(['$provide', function($provide) {
$provide.factory('workspacesNonCompliance', ['$filter', function($filter) {
return {
NonComplianceReasons: [
{name: $filter('translate')('NONCOMPLIANT.ALL'), noncompliant_properties: '' },
{name: $filter('translate')('NONCOMPLIANT.JAIL_BREAK_DETECTION'), noncompliant_properties: 'jail_break_detection' },
{name: $filter('translate')('NONCOMPLIANT.COMPLIANCE_ROOTED_DETECTION'), noncompliant_properties: 'compliance_rooted_detection' },
{name: $filter('translate')('NONCOMPLIANT.COMPLIANCE_USB_DEBUGGING'), noncompliant_properties: 'compliance_usb_debugging'},
{name: $filter('translate')('NONCOMPLIANT.POLICY_EXPIRED'), noncompliant_properties: 'policy_expired'}
]
};
}]);
}]);
を私のモジュールは、次のとおりです。
angular.module('ps.workspaces', [
'ps.workspaces.workspacesDirective',
'ps.workspaces.workspacesFactories'
]);
私のテストは次のとおりです。
describe('Tests for workspacesNonCompliance /', function() {
var workspacesNonCompliance,
$provider,
$filter;
// beforeEach(module('ps.workspaces'));
// beforeEach(module('ps.workspaces.workspacesDirective'));
// beforeEach(module('ps.workspaces.workspacesFactories'));
beforeEach(function(){
angular.module('ps.workspaces', [
'ps.workspaces.workspacesDirective',
'ps.workspaces.workspacesFactories'
]);
});
describe('workspacesNonCompliance is array of noncompliance reasons /', function() {
beforeEach(function() {
inject(function ($injector) {
workspacesNonCompliance = $injector.get('workspacesNonCompliance');
$filter = $injector.get('$filter');
});
});
it('workspacesNonCompliance has array of noncompliance reasons', function() {
console.log('******* workspacesNonCompliance ', workspacesNonCompliance);
expect(workspacesNonCompliance.NonComplianceReasons).toContain({name: $filter('translate')('NONCOMPLIANT.ALL'), noncompliant_properties: '' });
});
});
});
テストを実行し、エラーメッセージを受け取りました:
エラー:[$インジェクター:UNPR]不明プロバイダ:?workspacesNonComplianceProvider < - workspacesNonCompliance http://errors.angularjs.org/1.3.18/ $インジェクター/ UNPR P0 = workspacesNonComplianceProvider%20%3C-%20workspacesNonCompliance で/ユーザ/ joannepham/gitの/ PWS /コンソール-UI/bower_components /角度/角度.js:63:12 /Users/joannepham/git/pws/console-ui/bower_components/angular/angular.js:4031:19
修正する必要があるものを把握できませんでしたこの場合。助けてください