angularjs - Unit test onEnter with ui-router -
i have state onenter block following. i'm trying redirect based on data.length . .state('home', { url: '/', data: { title: 'home', }, controller: 'homectrl home', templateprovider: function($templatecache) { return $templatecache.get('views/home.html'); }, onenter: function(data, $state) {); if (data.length === 2) { $state.go('profile'); } } }); how can unit-test piece of code?