What is the best practice when testing Angular routes?
For example, I'm using UI Router to define states. How can I test that the route was called correctly as well as testing the resolve
?
$stateProvider
.state('example', {
url: '/example',
data: {
title: 'Example',
requiresLogin: false
},
controller: 'ExampleCtrl as example',
resolve: {
data: function(ExampleService, ExampleService2, $q) {
return $q.all({
example1: ExampleService.get().$promise,
example2: ExampleService2.get().$promise
});
}
},
templateProvider: function($templateCache) {
return $templateCache.get('views/example.html');
}
})
Aucun commentaire:
Enregistrer un commentaire