Ability to check if loggedIn based on provider (#5598)

* Provide a way to check if loggedIn based on provider

* Fix the comments

* Add schema validation for provider
This commit is contained in:
Maurizio Vitale
2020-04-08 16:43:36 +01:00
committed by GitHub
parent e55d3e53bb
commit 83e362d31a
4 changed files with 26 additions and 0 deletions

View File

@@ -76,6 +76,11 @@ describe('AuthenticationService', () => {
expect(apiService.getInstance).toHaveBeenCalled();
});
it('should check if loggedin on ECM in case the provider is ECM', () => {
spyOn(authService, 'isEcmLoggedIn').and.returnValue(true);
expect(authService.isLoggedInWith('ECM')).toBe(true);
});
it('should require remember me set for ECM check', () => {
spyOn(cookie, 'isEnabled').and.returnValue(true);
spyOn(authService, 'isRememberMeSet').and.returnValue(false);
@@ -198,6 +203,11 @@ describe('AuthenticationService', () => {
expect(apiService.getInstance).not.toHaveBeenCalled();
});
it('should check if loggedin on BPM in case the provider is BPM', () => {
spyOn(authService, 'isBpmLoggedIn').and.returnValue(true);
expect(authService.isLoggedInWith('BPM')).toBe(true);
});
it('should not require cookie service enabled for BPM check', () => {
spyOn(cookie, 'isEnabled').and.returnValue(false);
spyOn(authService, 'isRememberMeSet').and.returnValue(false);