Skip to content

Instantly share code, notes, and snippets.

@mcranston18
Last active August 29, 2015 14:05
Show Gist options
  • Save mcranston18/c14bffa5caa3a5398fa5 to your computer and use it in GitHub Desktop.
Save mcranston18/c14bffa5caa3a5398fa5 to your computer and use it in GitHub Desktop.
Sample Angular Test
'use strict';
describe('PhotoCtrl', function() {
var ctrl, rootScope, scope, q, Mock;
beforeEach(angular.mock.module('app.photo', 'ui.router'));
beforeEach(inject(function($controller, _$rootScope_, _$location_, _$state_, _$q_) {
rootScope = _$rootScope_;
scope = rootScope.$new();
q = _$q_;
state = _$state_;
// Mocks
Mock = {
PhotoService: {
apiMapping: {
returnStatus: function() { }
}
},
UserService: {},
AuthService: {},
getPhoto: {
id: 'bkdzv0l28hj6r24frmyy',
embed_url: 'http://www.vandelayindustries.com'
}
};
ctrl = $controller('PhotoCtrl', {
$rootScope: rootScope,
$scope: scope,
$location: _$location_,
state = _$state_,
AuthService: Mock.AuthService,
PhotoService: Mock.PhotoService,
UserService: Mock.UserService,
getPhoto: Mock.getPhoto
});
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment