Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 使用角度E2E时.passThrough()出错_Angularjs_Testing_Jasmine_Ngmocke2e - Fatal编程技术网

Angularjs 使用角度E2E时.passThrough()出错

Angularjs 使用角度E2E时.passThrough()出错,angularjs,testing,jasmine,ngmocke2e,Angularjs,Testing,Jasmine,Ngmocke2e,我试图使用Angular MockE2E测试我真正的API,但使用.passThrough函数时出错 这是我的密码: describe('simple test', function () { var $controller, $httpBackend; beforeEach(module('UCA-app')); beforeEach(inject(function ($rootScope, _$controller_, _$httpBackend_, _SignupService_, _U

我试图使用Angular MockE2E测试我真正的API,但使用.passThrough函数时出错

这是我的密码:

describe('simple test', function () {
var $controller, $httpBackend;

beforeEach(module('UCA-app'));
beforeEach(inject(function ($rootScope, _$controller_, _$httpBackend_, _SignupService_, _UserService_) {
        $controller = _$controller_;
        $httpBackend = _$httpBackend_;
        SignupService = _SignupService_;
        UserService = _UserService_;
        $scope = $rootScope.$new();
        $httpBackend.whenGET('http://localhost:2684/api/Account/GetPasswordPolicyMessage').passThrough();
}));

});
将返回此错误:

错误:意外请求:获取

我尝试测试的方法默认情况下在控制器上运行,但当我更改passthrough时,会这样:

$httpBackend.expectGET('http://localhost:2684/api/Account/GetPasswordPolicyMessage').passThrough();
我得到一个错误:

TypeError:$httpBackend.expectGET(…)。传递不是函数

你知道我做错了什么,或者我是否应该为测试实际的API而设置不同的设置