For a defined object is giving the error of indefinite in angularjs

1

I'm getting an error while performing the following test:

it('testing if the onStateChangeErrorHandle function is defined', function(){
  expect(rootScope.$on).toBeDefined();              
  srv.onStateChangeError({$rootScope: rootScope});
});

ERROR:

  

TypeError: undefined is not an object (evaluating 'rootScope. $ on')

And I'm not realizing why.

    
asked by anonymous 21.09.2017 / 15:31

0 answers