Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- login.submitLogin = function(){
- LoginFactory.loginUser(login.dataset)
- .then(function(response){
- $window.location.href = '/profile'
- },function(response) {
- login.errorMessage = response.data.message;
- });
- };
- describe('Login Controller', function() {
- var controller, window;
- beforeEach(angular.mock.module('app'));
- beforeEach(inject(function(_$controller_, _$window_){
- window = _$window_;
- controller = _$controller_('LoginCtrl',window);
- }));
- describe('Login', function() {
- it('expects controller to be defined', function(){
- expect(controller).to.be.defined;
- });
- it('expects to be redirected after login', function() {
- controller.username = 'username';
- controller.password = 'password';
- controller.submitLogin();
- expect(window.location.href).toEqual('/profile');
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement