控制器未注册因果茉莉角js单元测试错误

时间:2019-01-25 06:33:06

标签: angularjs jasmine karma-jasmine

控制器未注册因果茉莉花angularjs错误

  (function() {
    angular.module('Citi.iv.FC').controller('SampleController', sampleController);
    sampleController.$inject = ['$scope'];
    function sampleController($scope) {
        alert('hi');
          var vm = this;
    }
})();

规格文件如下

describe('myserv', function () {
    var $rootScope,$scope, $timeout, $filter, $uibModal, Upload, CreditCardService,controller;


    beforeAll(function () { 
        angular.mock.module('ui.router');
        angular.mock.module('Citi.iv.FC');
    }); 

    beforeEach(angular.mock.inject(function( _$rootScope_, _$controller_) {
        $scope = _$rootScope_ .$new();
        $controller = _$controller_;
        controller = $controller('SampleController', {
            $scope: $scope,
        });

    }));


      it('ServiceTestSpec', function () {
          expect(3 + 3).toBe(6);
      });
});

0 个答案:

没有答案