在使用jasmine编写服务单元测试时无法注入$ resource,adalAuthenticationService

时间:2016-06-23 09:48:49

标签: angularjs unit-testing jasmine adal.js

数据服务



var dataService = (function() {
      function dataService($q, $resource, adalAuthenticationService) {
        this.$q = $q;
        this.$resource = $resource;
        this.adal = new AuthenticationContext(adalAuthenticationService.config);
      }
});




测试用例



describe("dataService UT Suite", function() {
  var $q;
  var $resource;
  var adal;
  var dataService;
  beforeEach(module("Utils"));
  beforeEach(inject(function($q, $resource, _adalAuthenticationService_, _dataService_) {
    $q = _$q;
    $resource = $resource;
    adal = adalAuthenticationService;
    dataService = _dataService _;
  }));
});




上述服务代码,在typescript文件中写为名为dataService的服务。 我无法在使用jasmine的单元测试中注入$resourceadaldataService

你能告诉我如何解决这个问题。

0 个答案:

没有答案
相关问题