Skip to content

Instantly share code, notes, and snippets.

View morrislaptop's full-sized avatar

Craig Morris morrislaptop

View GitHub Profile
@morrislaptop
morrislaptop / stateMock.js
Last active November 23, 2015 08:51 — forked from wilsonwc/stateMock.js
angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = [];
this.current = {};
this.transitionTo = function(stateName){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName){
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
}