mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge branch 'master' into Misc-edit-community-and-collection-bugs
This commit is contained in:
@@ -150,7 +150,8 @@ describe('AuthEffects', () => {
|
|||||||
|
|
||||||
describe('authenticatedSuccess$', () => {
|
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-', {
|
actions = hot('--a-', {
|
||||||
a: {
|
a: {
|
||||||
type: AuthActionTypes.AUTHENTICATED_SUCCESS, payload: {
|
type: AuthActionTypes.AUTHENTICATED_SUCCESS, payload: {
|
||||||
@@ -163,8 +164,14 @@ describe('AuthEffects', () => {
|
|||||||
|
|
||||||
const expected = cold('--b-', { b: new RetrieveAuthenticatedEpersonAction(EPersonMock._links.self.href) });
|
const expected = cold('--b-', { b: new RetrieveAuthenticatedEpersonAction(EPersonMock._links.self.href) });
|
||||||
|
|
||||||
|
authEffects.authenticatedSuccess$.subscribe(() => {
|
||||||
|
expect(authServiceStub.storeToken).toHaveBeenCalledWith(token);
|
||||||
|
});
|
||||||
|
|
||||||
expect(authEffects.authenticatedSuccess$).toBeObservable(expected);
|
expect(authEffects.authenticatedSuccess$).toBeObservable(expected);
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('checkToken$', () => {
|
describe('checkToken$', () => {
|
||||||
|
@@ -65,7 +65,6 @@ export class AuthEffects {
|
|||||||
@Effect()
|
@Effect()
|
||||||
public authenticateSuccess$: Observable<Action> = this.actions$.pipe(
|
public authenticateSuccess$: Observable<Action> = this.actions$.pipe(
|
||||||
ofType(AuthActionTypes.AUTHENTICATE_SUCCESS),
|
ofType(AuthActionTypes.AUTHENTICATE_SUCCESS),
|
||||||
tap((action: AuthenticationSuccessAction) => this.authService.storeToken(action.payload)),
|
|
||||||
map((action: AuthenticationSuccessAction) => new AuthenticatedAction(action.payload))
|
map((action: AuthenticationSuccessAction) => new AuthenticatedAction(action.payload))
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -82,6 +81,7 @@ export class AuthEffects {
|
|||||||
@Effect()
|
@Effect()
|
||||||
public authenticatedSuccess$: Observable<Action> = this.actions$.pipe(
|
public authenticatedSuccess$: Observable<Action> = this.actions$.pipe(
|
||||||
ofType(AuthActionTypes.AUTHENTICATED_SUCCESS),
|
ofType(AuthActionTypes.AUTHENTICATED_SUCCESS),
|
||||||
|
tap((action: AuthenticatedSuccessAction) => this.authService.storeToken(action.payload.authToken)),
|
||||||
map((action: AuthenticatedSuccessAction) => new RetrieveAuthenticatedEpersonAction(action.payload.userHref))
|
map((action: AuthenticatedSuccessAction) => new RetrieveAuthenticatedEpersonAction(action.payload.userHref))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user