1
0

Invalidate authorization requests cache on REHYDRATE

This commit is contained in:
Giuseppe Digilio
2021-07-20 11:02:02 +02:00
parent fbde0cbad9
commit b04c33a5fb
4 changed files with 27 additions and 4 deletions

View File

@@ -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();
});
});
});