1
0

removed getUserState from Auth service

This commit is contained in:
David Baldwynn 2017-11-20 19:58:43 -08:00
parent 1c4ce87084
commit f3f9232c62
4 changed files with 1 additions and 26 deletions

View File

@ -138,9 +138,6 @@
},
isAuthenticated: function() {
return true;
},
getUserState: function() {
return true;
}
};
});

View File

@ -47,10 +47,6 @@ angular.module('users').factory('Auth', ['$window', '$q', 'User',
return !!this._currentUser && this._currentUser.username;
},
getUserState: function() {
return userState;
},
login: function(new_user) {
userState.isLoggedIn = true;
this._currentUser = new_user;

View File

@ -133,9 +133,6 @@
},
isAuthenticated: function() {
return true;
},
getUserState: function() {
return true;
}
};
});

View File

@ -61,23 +61,8 @@
expect($window.user).toEqual(null);
expect(Auth.currentUser).toEqual(null);
expect(Auth.isAuthenticated()).toBe(false);
expect(Auth.getUserState().isLoggedIn).toBe(false);
}));
it('Auth.getUserState() should fetch current user state', function() {
//Run Service Logic to Test
Auth.login(sampleUser);
var currUserState = Auth.getUserState();
expect(currUserState.isLoggedIn).toBe(true);
//Run Service Logic to Test
Auth.logout();
currUserState = Auth.getUserState();
expect(currUserState.isLoggedIn).toBe(false);
});
it('Auth.ensureHasCurrentUser() should fetch most current user if it exists in $window, currentUser or fetch it from /users/me', function() {
//Run Service Logic to Test
Auth.ensureHasCurrentUser().then(function onSuccess(currUser){