forked from hazza/dspace-angular
Invalidate authorization requests cache on REHYDRATE
This commit is contained in:
@@ -5,16 +5,20 @@ import { cold, hot } from 'jasmine-marbles';
|
||||
import { ObjectCacheEffects } from './object-cache.effects';
|
||||
import { ResetObjectCacheTimestampsAction } from './object-cache.actions';
|
||||
import { StoreActionTypes } from '../../store.actions';
|
||||
import { AuthorizationDataService } from '../data/feature-authorization/authorization-data.service';
|
||||
|
||||
describe('ObjectCacheEffects', () => {
|
||||
let cacheEffects: ObjectCacheEffects;
|
||||
let actions: Observable<any>;
|
||||
const timestamp = 10000;
|
||||
const authorizationService = jasmine.createSpyObj(['invalidateAuthorizationsRequestCache']);
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
ObjectCacheEffects,
|
||||
provideMockActions(() => actions),
|
||||
{ provide: AuthorizationDataService, useValue: authorizationService },
|
||||
// other providers
|
||||
],
|
||||
});
|
||||
@@ -33,6 +37,7 @@ describe('ObjectCacheEffects', () => {
|
||||
const expected = cold('--b-', { b: new ResetObjectCacheTimestampsAction(new Date().getTime()) });
|
||||
|
||||
expect(cacheEffects.fixTimestampsOnRehydrate).toBeObservable(expected);
|
||||
expect((cacheEffects as any).authorizationsService.invalidateAuthorizationsRequestCache).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user