-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Implements receipt of jwt token on signup - Implements correct controller on signup/login page - Implements caching of data in browser [Finishes #158457035]
- Loading branch information
Showing
23 changed files
with
475 additions
and
332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* eslint prefer-arrow-callback: 0, func-names: 0, no-undef: 0 */ | ||
describe('AuthController', function () { | ||
let $scope, $location, controller; | ||
beforeEach(module('mean.system')); | ||
mockApireq = function () { | ||
return { | ||
execute(a, b, callback) { | ||
return callback({ token: 'Thisisatesttoken' }); | ||
} | ||
}; | ||
}; | ||
beforeEach(inject(function (_$controller_, _$rootScope_, _$location_) { | ||
// assining providers to global scope | ||
$scope = _$rootScope_.$new(); | ||
$location = _$location_; | ||
controller = _$controller_; | ||
controller('AuthController', { | ||
$scope, | ||
$resource: mockApireq, | ||
$location | ||
}); | ||
})); | ||
|
||
it('Should sign up the user successfully, setting the token to local storage ater', function () { | ||
$scope.newUser = { name: 'Test User', email: 'test@test', password: 'test123' }; | ||
$scope.SignUpUser(); | ||
const token = localStorage.getItem('#cfhetusertoken'); | ||
expect(token).toEqual('Thisisatesttoken'); | ||
expect($location.path()).toBe('/app'); | ||
}); | ||
|
||
it('Should log in the user with the successful data then set the returning token to local storage', function () { | ||
$scope.user = { name: 'Test User', email: 'test@test', password: 'test123' }; | ||
// listen for calls to the api | ||
$scope.SignInUser(); | ||
const token = localStorage.getItem('#cfhetusertoken'); | ||
// check the token now | ||
expect(token).toEqual('Thisisatesttoken'); | ||
expect($location.path()).toBe('/app'); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.