Advertisement
Guest User

Untitled

a guest
Aug 11th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. login.submitLogin = function(){
  2. LoginFactory.loginUser(login.dataset)
  3. .then(function(response){
  4. $window.location.href = '/profile'
  5. },function(response) {
  6. login.errorMessage = response.data.message;
  7. });
  8. };
  9.  
  10. describe('Login Controller', function() {
  11.  
  12. var controller, window;
  13.  
  14. beforeEach(angular.mock.module('app'));
  15.  
  16. beforeEach(inject(function(_$controller_, _$window_){
  17. window = _$window_;
  18. controller = _$controller_('LoginCtrl',window);
  19. }));
  20.  
  21. describe('Login', function() {
  22.  
  23. it('expects controller to be defined', function(){
  24. expect(controller).to.be.defined;
  25. });
  26.  
  27. it('expects to be redirected after login', function() {
  28. controller.username = 'username';
  29. controller.password = 'password';
  30. controller.submitLogin();
  31. expect(window.location.href).toEqual('/profile');
  32. });
  33. });
  34. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement