mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 22:43:03 +00:00
Merge branch 'master' into CST-3090-collection-dropdown
This commit is contained in:
@@ -150,7 +150,8 @@ describe('AuthEffects', () => {
|
||||
|
||||
describe('authenticatedSuccess$', () => {
|
||||
|
||||
it('should return a RETRIEVE_AUTHENTICATED_EPERSON action in response to a AUTHENTICATED_SUCCESS action', () => {
|
||||
it('should return a RETRIEVE_AUTHENTICATED_EPERSON action in response to a AUTHENTICATED_SUCCESS action', (done) => {
|
||||
spyOn((authEffects as any).authService, 'storeToken');
|
||||
actions = hot('--a-', {
|
||||
a: {
|
||||
type: AuthActionTypes.AUTHENTICATED_SUCCESS, payload: {
|
||||
@@ -163,8 +164,14 @@ describe('AuthEffects', () => {
|
||||
|
||||
const expected = cold('--b-', { b: new RetrieveAuthenticatedEpersonAction(EPersonMock._links.self.href) });
|
||||
|
||||
authEffects.authenticatedSuccess$.subscribe(() => {
|
||||
expect(authServiceStub.storeToken).toHaveBeenCalledWith(token);
|
||||
});
|
||||
|
||||
expect(authEffects.authenticatedSuccess$).toBeObservable(expected);
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('checkToken$', () => {
|
||||
|
@@ -65,7 +65,6 @@ export class AuthEffects {
|
||||
@Effect()
|
||||
public authenticateSuccess$: Observable<Action> = this.actions$.pipe(
|
||||
ofType(AuthActionTypes.AUTHENTICATE_SUCCESS),
|
||||
tap((action: AuthenticationSuccessAction) => this.authService.storeToken(action.payload)),
|
||||
map((action: AuthenticationSuccessAction) => new AuthenticatedAction(action.payload))
|
||||
);
|
||||
|
||||
@@ -82,6 +81,7 @@ export class AuthEffects {
|
||||
@Effect()
|
||||
public authenticatedSuccess$: Observable<Action> = this.actions$.pipe(
|
||||
ofType(AuthActionTypes.AUTHENTICATED_SUCCESS),
|
||||
tap((action: AuthenticatedSuccessAction) => this.authService.storeToken(action.payload.authToken)),
|
||||
map((action: AuthenticatedSuccessAction) => new RetrieveAuthenticatedEpersonAction(action.payload.userHref))
|
||||
);
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import * as fileSize from 'filesize';
|
||||
|
||||
/*
|
||||
* Convert bytes into largest possible unit.
|
||||
@@ -12,30 +13,7 @@ import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({ name: 'dsFileSize' })
|
||||
export class FileSizePipe implements PipeTransform {
|
||||
|
||||
private units: string[] = [
|
||||
'bytes',
|
||||
'KiB',
|
||||
'MiB',
|
||||
'GiB',
|
||||
'TiB',
|
||||
'PiB'
|
||||
];
|
||||
|
||||
transform(bytes: number = 0, precision: number = 2): string {
|
||||
let result: string;
|
||||
if (isNaN(parseFloat(String(bytes))) || !isFinite(bytes)) {
|
||||
result = '?';
|
||||
} else {
|
||||
let unit = 0;
|
||||
|
||||
while (bytes >= 1024) {
|
||||
bytes /= 1024;
|
||||
unit++;
|
||||
}
|
||||
|
||||
result = bytes.toFixed(+ precision) + ' ' + this.units[unit];
|
||||
}
|
||||
return result;
|
||||
return fileSize(bytes, { standard: 'jedec', round: precision });
|
||||
}
|
||||
}
|
||||
|
@@ -52,11 +52,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
||||
@@ -64,4 +59,6 @@ import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
import 'core-js/es';
|
||||
import 'core-js/features/reflect';
|
||||
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
import 'reflect-metadata';
|
||||
|
Reference in New Issue
Block a user