130: more core tests

This commit is contained in:
Lotte Hofstede
2017-11-29 15:36:54 +01:00
parent 553d1d6ffd
commit 4b94f8bb4d
8 changed files with 269 additions and 361 deletions

View File

@@ -0,0 +1,24 @@
import { Injectable } from '@angular/core';
import { Actions, Effect } from '@ngrx/effects';
import { StoreActionTypes } from '../../store.actions';
import { ResetObjectCacheTimestampsAction } from './object-cache.actions';
@Injectable()
export class ObjectCacheEffects {
/**
* When the store is rehydrated in the browser, set all cache
* timestamps to 'now', because the time zone of the server can
* differ from the client.
*
* This assumes that the server cached everything a negligible
* time ago, and will likely need to be revisited later
*/
@Effect() fixTimestampsOnRehydrate = this.actions$
.ofType(StoreActionTypes.REHYDRATE)
.map(() => new ResetObjectCacheTimestampsAction(new Date().getTime()));
constructor(private actions$: Actions) { }
}