Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View geraldofcneto's full-sized avatar

Geraldo Castro geraldofcneto

View GitHub Profile
angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = [];
this.transitionTo = function(stateName, params){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState.stateName !== stateName){
throw Error('Expected transition to state: ' + expectedState.stateName + ' but transitioned to ' + stateName );
}
if(expectedState.params && !angular.equals(expectedState.params, params)){