store token on AUTHENTICATED_SUCCESS action

This commit is contained in:
Giuseppe Digilio
2020-06-11 14:15:19 +02:00
parent ea26597b6a
commit 6bd04c94ec
2 changed files with 9 additions and 2 deletions

View File

@@ -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 not call removeToken method', (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$', () => {