Merge branch 'master' into angular-cli

This commit is contained in:
lotte
2020-03-31 13:49:40 +02:00
72 changed files with 2709 additions and 415 deletions

View File

@@ -28,6 +28,8 @@ import { Observable } from 'rxjs/internal/Observable';
import { RemoteData } from '../data/remote-data';
import { EPersonDataService } from '../eperson/eperson-data.service';
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
import { authMethodsMock } from '../../shared/testing/auth-service.stub';
import { AuthMethod } from './models/auth.method';
describe('AuthService test', () => {
@@ -150,6 +152,26 @@ describe('AuthService test', () => {
expect(authService.logout.bind(null)).toThrow();
});
it('should return the authentication status object to check an Authentication Cookie', () => {
authService.checkAuthenticationCookie().subscribe((status: AuthStatus) => {
expect(status).toBeDefined();
});
});
it('should return the authentication methods available', () => {
const authStatus = new AuthStatus();
authService.retrieveAuthMethodsFromAuthStatus(authStatus).subscribe((authMethods: AuthMethod[]) => {
expect(authMethods).toBeDefined();
expect(authMethods.length).toBe(0);
});
authStatus.authMethods = authMethodsMock;
authService.retrieveAuthMethodsFromAuthStatus(authStatus).subscribe((authMethods: AuthMethod[]) => {
expect(authMethods).toBeDefined();
expect(authMethods.length).toBe(2);
});
});
});
describe('', () => {