Unit test onEnter with ui-router

I have a status block onEnter

as shown below. I am trying to do a data.length

.

  .state('home', {
    url: '/',
    data: {
      title: 'Home',
    },
    controller: 'HomeCtrl as home',
    templateProvider: function($templateCache) {
      return $templateCache.get('views/home.html');
    },
    onEnter: function(data, $state) {);
      if (data.length === 2) {
        $state.go('profile');
      }
    }
  });

      

How can I properly test this piece of code?

+3


source to share





All Articles