0

我正在制作一个有角度的应用程序,并正在对它们进行端到端测试。我需要为$httpBackend我的一些测试运行一个实例,但我不知道该怎么做。目前我的代码看起来像

myApp = angular.module('myApp', []);
myApp.controller('Controller', function () {
    $http.post('/register/reg').success(function () console.log('yay'););
\\ things...
myTestingApp = angular.module('myTestingApp', ['myApp', 'ngMockE2E']);
myTestingApp.run(function ($httpBackend) {
    $httpBackend.whenPOST('/\/register\/reg.*/').respond(200);
});

然后我只是导航到runner.html并运行我的测试。我的所有其他测试都被 Karma 看到,但事实并非如此。这是怎么回事?

4

0 回答 0