Angularjs $httpBackend.flush()导致路由更改

Angularjs $httpBackend.flush()导致路由更改,angularjs,angular-ui-router,Angularjs,Angular Ui Router,我最近将Angular应用程序从1.5.8更新为1.6.1。 在测试中,$httpBackend.flush()开始更改路由并广播“$routeChangeStart”消息,该消息开始调用侦听事件的函数 我在迁移过程中遗漏了什么吗 //Function listening to the $routeChangeStart $rootScope.$on("$routeChangeStart", function (event, next) { console.log('This is ca

我最近将Angular应用程序从1.5.8更新为1.6.1。 在测试中,$httpBackend.flush()开始更改路由并广播“$routeChangeStart”消息,该消息开始调用侦听事件的函数

我在迁移过程中遗漏了什么吗

//Function listening to the $routeChangeStart
$rootScope.$on("$routeChangeStart", function (event, next) {
    console.log('This is called');
});

//Test
describe('Testing', function() {
  it.only('Testing', function() {
    //Code
    $httpBackend.when('GET', endpoints.endpoint1).respond([]);
    $httpBackend.flush();

  });
});

请添加以下内容:
$httpBackend.whenGET('url').response(200,{data:“ok”})在您的测试中

请共享code@Codesingh分享有什么区别$httpBackend.flush()正在调用路由更改。