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,38 @@
import { TestBed } from '@angular/core/testing';
import { Observable } from 'rxjs/Observable';
import { provideMockActions } from '@ngrx/effects/testing';
import { cold, hot } from 'jasmine-marbles';
import { ObjectCacheEffects } from './object-cache.effects';
import { ResetObjectCacheTimestampsAction } from './object-cache.actions';
import { StoreActionTypes } from '../../store.actions';
describe('ObjectCacheEffects', () => {
let cacheEffects: ObjectCacheEffects;
let actions: Observable<any>;
const timestamp = 10000;
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
ObjectCacheEffects,
provideMockActions(() => actions),
// other providers
],
});
cacheEffects = TestBed.get(ObjectCacheEffects);
});
describe('fixTimestampsOnRehydrate$', () => {
it('should return a RESET_TIMESTAMPS action in response to an REHYDRATE action to a new route', () => {
spyOn(Date.prototype, 'getTime').and.callFake(() => {
return timestamp;
});
actions = hot('--a-', { a: { type: StoreActionTypes.REHYDRATE, payload: {} } });
const expected = cold('--b-', { b: new ResetObjectCacheTimestampsAction(new Date().getTime()) });
expect(cacheEffects.fixTimestampsOnRehydrate).toBeObservable(expected);
});
});
});

View File

@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Actions, Effect } from '@ngrx/effects'; import { Actions, Effect } from '@ngrx/effects';
import { StoreActionTypes } from '../../store.actions'; import { StoreActionTypes } from '../../store.actions';
import { ResetObjectCacheTimestampsAction } from '../cache/object-cache.actions'; import { ResetObjectCacheTimestampsAction } from './object-cache.actions';
@Injectable() @Injectable()
export class ObjectCacheEffects { export class ObjectCacheEffects {

View File

@@ -0,0 +1,38 @@
import { TestBed } from '@angular/core/testing';
import { Observable } from 'rxjs/Observable';
import { provideMockActions } from '@ngrx/effects/testing';
import { cold, hot } from 'jasmine-marbles';
import { StoreActionTypes } from '../../store.actions';
import { ResponseCacheEffects } from './response-cache.effects';
import { ResetResponseCacheTimestampsAction } from './response-cache.actions';
describe('ResponseCacheEffects', () => {
let cacheEffects: ResponseCacheEffects;
let actions: Observable<any>;
const timestamp = 10000;
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
ResponseCacheEffects,
provideMockActions(() => actions),
// other providers
],
});
cacheEffects = TestBed.get(ResponseCacheEffects);
});
describe('fixTimestampsOnRehydrate$', () => {
it('should return a RESET_TIMESTAMPS action in response to an REHYDRATE action to a new route', () => {
spyOn(Date.prototype, 'getTime').and.callFake(() => {
return timestamp;
});
actions = hot('--a-', { a: { type: StoreActionTypes.REHYDRATE, payload: {} } });
const expected = cold('--b-', { b: new ResetResponseCacheTimestampsAction(new Date().getTime()) });
expect(cacheEffects.fixTimestampsOnRehydrate).toBeObservable(expected);
});
});
});

View File

@@ -1,11 +1,11 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Actions, Effect } from '@ngrx/effects'; import { Actions, Effect } from '@ngrx/effects';
import { ResetResponseCacheTimestampsAction } from '../cache/response-cache.actions'; import { ResetResponseCacheTimestampsAction } from './response-cache.actions';
import { StoreActionTypes } from '../../store.actions'; import { StoreActionTypes } from '../../store.actions';
@Injectable() @Injectable()
export class RequestCacheEffects { export class ResponseCacheEffects {
/** /**
* When the store is rehydrated in the browser, set all cache * When the store is rehydrated in the browser, set all cache

View File

@@ -4,8 +4,9 @@ import { responseCacheReducer, ResponseCacheState } from './response-cache.reduc
import { import {
ResponseCacheRemoveAction, ResponseCacheRemoveAction,
ResetResponseCacheTimestampsAction ResetResponseCacheTimestampsAction, ResponseCacheAddAction
} from './response-cache.actions'; } from './response-cache.actions';
import { RestResponse } from './response-cache.models';
class NullAction extends ResponseCacheRemoveAction { class NullAction extends ResponseCacheRemoveAction {
type = null; type = null;
@@ -16,212 +17,108 @@ class NullAction extends ResponseCacheRemoveAction {
} }
} }
// describe('responseCacheReducer', () => { describe('responseCacheReducer', () => {
// const keys = ['125c17f89046283c5f0640722aac9feb', 'a06c3006a41caec5d635af099b0c780c']; const keys = ['125c17f89046283c5f0640722aac9feb', 'a06c3006a41caec5d635af099b0c780c'];
// const services = [new OpaqueToken('service1'), new OpaqueToken('service2')]; const msToLive = 900000;
// const msToLive = 900000; const uuids = [
// const uuids = [ '9e32a2e2-6b91-4236-a361-995ccdc14c60',
// '9e32a2e2-6b91-4236-a361-995ccdc14c60', '598ce822-c357-46f3-ab70-63724d02d6ad',
// '598ce822-c357-46f3-ab70-63724d02d6ad', 'be8325f7-243b-49f4-8a4b-df2b793ff3b5'
// 'be8325f7-243b-49f4-8a4b-df2b793ff3b5' ];
// ]; const testState: ResponseCacheState = {
// const resourceID = '9978'; [keys[0]]: {
// const paginationOptions = { 'resultsPerPage': 10, 'currentPage': 1 }; key: keys[0],
// const sortOptions = { 'field': 'id', 'direction': 0 }; response: new RestResponse(true, '200'),
// const testState = { timeAdded: new Date().getTime(),
// [keys[0]]: { msToLive: msToLive
// 'key': keys[0], },
// 'service': services[0], [keys[1]]: {
// 'resourceUUIDs': [uuids[0], uuids[1]], key: keys[1],
// 'isLoading': false, response: new RestResponse(true, '200'),
// 'paginationOptions': paginationOptions, timeAdded: new Date().getTime(),
// 'sortOptions': sortOptions, msToLive: msToLive
// 'timeAdded': new Date().getTime(), }
// 'msToLive': msToLive };
// }, deepFreeze(testState);
// [keys[1]]: { const errorState: {} = {
// 'key': keys[1], [keys[0]]: {
// 'service': services[1], errorMessage: 'error',
// 'resourceID': resourceID, resourceUUIDs: uuids
// 'resourceUUIDs': [uuids[2]], }
// 'isLoading': false, };
// 'timeAdded': new Date().getTime(), deepFreeze(errorState);
// 'msToLive': msToLive
// } it('should return the current state when no valid actions have been made', () => {
// }; const action = new NullAction();
// deepFreeze(testState); const newState = responseCacheReducer(testState, action);
// const errorState: {} = {
// [keys[0]]: { expect(newState).toEqual(testState);
// errorMessage: 'error', });
// resourceUUIDs: uuids
// } it('should start with an empty cache', () => {
// }; const action = new NullAction();
// deepFreeze(errorState); const initialState = responseCacheReducer(undefined, action);
//
// expect(initialState).toEqual(Object.create(null));
// it('should return the current state when no valid actions have been made', () => { });
// const action = new NullAction();
// const newState = responseCacheReducer(testState, action); describe('ADD', () => {
// const addTimeAdded = new Date().getTime();
// expect(newState).toEqual(testState); const addMsToLive = 5;
// }); const addResponse = new RestResponse(true, '200');
// const action = new ResponseCacheAddAction(keys[0], addResponse, addTimeAdded, addMsToLive);
// it('should start with an empty cache', () => {
// const action = new NullAction(); it('should perform the action without affecting the previous state', () => {
// const initialState = responseCacheReducer(undefined, action); // testState has already been frozen above
// responseCacheReducer(testState, action);
// expect(initialState).toEqual(Object.create(null)); });
// });
// it('should add the response to the cached request', () => {
// describe('FIND_BY_ID', () => { const newState = responseCacheReducer(testState, action);
// const action = new ResponseCacheFindByIDAction(keys[0], services[0], resourceID); expect(newState[keys[0]].timeAdded).toBe(addTimeAdded);
// expect(newState[keys[0]].msToLive).toBe(addMsToLive);
// it('should perform the action without affecting the previous state', () => { expect(newState[keys[0]].response).toBe(addResponse);
// //testState has already been frozen above });
// responseCacheReducer(testState, action); });
// });
// describe('REMOVE', () => {
// it('should add the request to the cache', () => { it('should perform the action without affecting the previous state', () => {
// const state = Object.create(null); const action = new ResponseCacheRemoveAction(keys[0]);
// const newState = responseCacheReducer(state, action); // testState has already been frozen above
// expect(newState[keys[0]].key).toBe(keys[0]); responseCacheReducer(testState, action);
// expect(newState[keys[0]].service).toEqual(services[0]); });
// expect(newState[keys[0]].resourceID).toBe(resourceID);
// }); it('should remove the specified request from the cache', () => {
// const action = new ResponseCacheRemoveAction(keys[0]);
// it('should set responsePending to true', () => { const newState = responseCacheReducer(testState, action);
// const state = Object.create(null); expect(testState[keys[0]]).not.toBeUndefined();
// const newState = responseCacheReducer(state, action); expect(newState[keys[0]]).toBeUndefined();
// expect(newState[keys[0]].responsePending).toBe(true); });
// });
// it('shouldn\'t do anything when the specified key isn\'t cached', () => {
// it('should remove any previous error message or resourceUUID for the request', () => { const wrongKey = 'this isn\'t cached';
// const newState = responseCacheReducer(errorState, action); const action = new ResponseCacheRemoveAction(wrongKey);
// expect(newState[keys[0]].resourceUUIDs.length).toBe(0); const newState = responseCacheReducer(testState, action);
// expect(newState[keys[0]].errorMessage).toBeUndefined(); expect(testState[wrongKey]).toBeUndefined();
// }); expect(newState).toEqual(testState);
// }); });
// });
// describe('FIND_ALL', () => {
// const action = new ResponseCacheFindAllAction(keys[0], services[0], resourceID, paginationOptions, sortOptions); describe('RESET_TIMESTAMPS', () => {
// const newTimeStamp = new Date().getTime();
// it('should perform the action without affecting the previous state', () => { const action = new ResetResponseCacheTimestampsAction(newTimeStamp);
// //testState has already been frozen above
// responseCacheReducer(testState, action); it('should perform the action without affecting the previous state', () => {
// }); // testState has already been frozen above
// responseCacheReducer(testState, action);
// it('should add the request to the cache', () => { });
// const state = Object.create(null);
// const newState = responseCacheReducer(state, action); it('should set the timestamp of all requests in the cache', () => {
// expect(newState[keys[0]].key).toBe(keys[0]); const newState = responseCacheReducer(testState, action);
// expect(newState[keys[0]].service).toEqual(services[0]); Object.keys(newState).forEach((key) => {
// expect(newState[keys[0]].scopeID).toBe(resourceID); expect(newState[key].timeAdded).toEqual(newTimeStamp);
// expect(newState[keys[0]].paginationOptions).toEqual(paginationOptions); });
// expect(newState[keys[0]].sortOptions).toEqual(sortOptions); });
// });
// });
// it('should set responsePending to true', () => { });
// const state = Object.create(null);
// const newState = responseCacheReducer(state, action);
// expect(newState[keys[0]].responsePending).toBe(true);
// });
//
// it('should remove any previous error message or resourceUUIDs for the request', () => {
// const newState = responseCacheReducer(errorState, action);
// expect(newState[keys[0]].resourceUUIDs.length).toBe(0);
// expect(newState[keys[0]].errorMessage).toBeUndefined();
// });
// });
//
// describe('SUCCESS', () => {
// const successUUIDs = [uuids[0], uuids[2]];
// const successTimeAdded = new Date().getTime();
// const successMsToLive = 5;
// const action = new ResponseCacheSuccessAction(keys[0], successUUIDs, successTimeAdded, successMsToLive);
//
// it('should perform the action without affecting the previous state', () => {
// //testState has already been frozen above
// responseCacheReducer(testState, action);
// });
//
// it('should add the response to the cached request', () => {
// const newState = responseCacheReducer(testState, action);
// expect(newState[keys[0]].resourceUUIDs).toBe(successUUIDs);
// expect(newState[keys[0]].timeAdded).toBe(successTimeAdded);
// expect(newState[keys[0]].msToLive).toBe(successMsToLive);
// });
//
// it('should set responsePending to false', () => {
// const newState = responseCacheReducer(testState, action);
// expect(newState[keys[0]].responsePending).toBe(false);
// });
//
// it('should remove any previous error message for the request', () => {
// const newState = responseCacheReducer(errorState, action);
// expect(newState[keys[0]].errorMessage).toBeUndefined();
// });
// });
//
// describe('ERROR', () => {
// const errorMsg = 'errorMsg';
// const action = new ResponseCacheErrorAction(keys[0], errorMsg);
//
// it('should perform the action without affecting the previous state', () => {
// //testState has already been frozen above
// responseCacheReducer(testState, action);
// });
//
// it('should set an error message for the request', () => {
// const newState = responseCacheReducer(errorState, action);
// expect(newState[keys[0]].errorMessage).toBe(errorMsg);
// });
//
// it('should set responsePending to false', () => {
// const newState = responseCacheReducer(testState, action);
// expect(newState[keys[0]].responsePending).toBe(false);
// });
// });
//
// describe('REMOVE', () => {
// it('should perform the action without affecting the previous state', () => {
// const action = new ResponseCacheRemoveAction(keys[0]);
// //testState has already been frozen above
// responseCacheReducer(testState, action);
// });
//
// it('should remove the specified request from the cache', () => {
// const action = new ResponseCacheRemoveAction(keys[0]);
// const newState = responseCacheReducer(testState, action);
// expect(testState[keys[0]]).not.toBeUndefined();
// expect(newState[keys[0]]).toBeUndefined();
// });
//
// it('shouldn't do anything when the specified key isn't cached', () => {
// const wrongKey = 'this isn't cached';
// const action = new ResponseCacheRemoveAction(wrongKey);
// const newState = responseCacheReducer(testState, action);
// expect(testState[wrongKey]).toBeUndefined();
// expect(newState).toEqual(testState);
// });
// });
//
// describe('RESET_TIMESTAMPS', () => {
// const newTimeStamp = new Date().getTime();
// const action = new ResetResponseCacheTimestampsAction(newTimeStamp);
//
// it('should perform the action without affecting the previous state', () => {
// //testState has already been frozen above
// responseCacheReducer(testState, action);
// });
//
// it('should set the timestamp of all requests in the cache', () => {
// const newState = responseCacheReducer(testState, action);
// Object.keys(newState).forEach((key) => {
// expect(newState[key].timeAdded).toEqual(newTimeStamp);
// });
// });
//
// });
//
//
// });

View File

@@ -1,147 +1,83 @@
import { OpaqueToken } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { ResponseCacheService } from './response-cache.service'; import { ResponseCacheService } from './response-cache.service';
import { ResponseCacheState, ResponseCacheEntry } from './response-cache.reducer'; import { Observable } from 'rxjs/Observable';
import { CoreState } from '../core.reducers';
import { RestResponse } from './response-cache.models';
import { ResponseCacheEntry } from './response-cache.reducer';
// describe('ResponseCacheService', () => { describe('ResponseCacheService', () => {
// let service: ResponseCacheService; let service: ResponseCacheService;
// let store: Store<ResponseCacheState>; let store: Store<CoreState>;
//
// const keys = ['125c17f89046283c5f0640722aac9feb', 'a06c3006a41caec5d635af099b0c780c']; const keys = ['125c17f89046283c5f0640722aac9feb', 'a06c3006a41caec5d635af099b0c780c'];
// const serviceTokens = [new OpaqueToken('service1'), new OpaqueToken('service2')]; const timestamp = new Date().getTime();
// const resourceID = '9978'; const validCacheEntry = (key) => {
// const paginationOptions = { 'resultsPerPage': 10, 'currentPage': 1 }; return {
// const sortOptions = { 'field': 'id', 'direction': 0 }; key: key,
// const timestamp = new Date().getTime(); response: new RestResponse(true, '200'),
// const validCacheEntry = (key) => { timeAdded: timestamp,
// return { msToLive: 24 * 60 * 60 * 1000 // a day
// key: key, }
// timeAdded: timestamp, };
// msToLive: 24 * 60 * 60 * 1000 // a day const invalidCacheEntry = (key) => {
// } return {
// }; key: key,
// const invalidCacheEntry = (key) => { response: new RestResponse(true, '200'),
// return { timeAdded: 0,
// key: key, msToLive: 0
// timeAdded: 0, }
// msToLive: 0 };
// }
// }; beforeEach(() => {
// store = new Store<CoreState>(undefined, undefined, undefined);
// beforeEach(() => { spyOn(store, 'dispatch');
// store = new Store<ResponseCacheState>(undefined, undefined, undefined); service = new ResponseCacheService(store);
// spyOn(store, 'dispatch'); spyOn(Date.prototype, 'getTime').and.callFake(() => {
// service = new ResponseCacheService(store); return timestamp;
// spyOn(window, 'Date').and.returnValue({ getTime: () => timestamp }); });
// }); });
//
// describe('findAll', () => { describe('get', () => {
// beforeEach(() => { it('should return an observable of the cached request with the specified key', () => {
// spyOn(service, 'get').and.callFake((key) => Observable.of({key: key})); spyOn(store, 'select').and.callFake((...args: any[]) => {
// }); return Observable.of(validCacheEntry(keys[1]));
// describe('if the key isn't cached', () => { });
// beforeEach(() => {
// spyOn(service, 'has').and.returnValue(false); let testObj: ResponseCacheEntry;
// }); service.get(keys[1]).first().subscribe((entry) => {
// it('should dispatch a FIND_ALL action with the key, service, scopeID, paginationOptions and sortOptions', () => { console.log(entry);
// service.findAll(keys[0], serviceTokens[0], resourceID, paginationOptions, sortOptions); testObj = entry;
// expect(store.dispatch).toHaveBeenCalledWith(new ResponseCacheFindAllAction(keys[0], serviceTokens[0], resourceID, paginationOptions, sortOptions)) });
// }); expect(testObj.key).toEqual(keys[1]);
// it('should return an observable of the newly cached request with the specified key', () => { });
// let result: ResponseCacheEntry;
// service.findAll(keys[0], serviceTokens[0], resourceID, paginationOptions, sortOptions).take(1).subscribe(entry => result = entry); it('should not return a cached request that has exceeded its time to live', () => {
// expect(result.key).toEqual(keys[0]); spyOn(store, 'select').and.callFake((...args: any[]) => {
// }); return Observable.of(invalidCacheEntry(keys[1]));
// }); });
// describe('if the key is already cached', () => {
// beforeEach(() => { let getObsHasFired = false;
// spyOn(service, 'has').and.returnValue(true); const subscription = service.get(keys[1]).subscribe((entry) => getObsHasFired = true);
// }); expect(getObsHasFired).toBe(false);
// it('shouldn't dispatch anything', () => { subscription.unsubscribe();
// service.findAll(keys[0], serviceTokens[0], resourceID, paginationOptions, sortOptions); });
// expect(store.dispatch).not.toHaveBeenCalled(); });
// });
// it('should return an observable of the existing cached request with the specified key', () => { describe('has', () => {
// let result: ResponseCacheEntry; it('should return true if the request with the supplied key is cached and still valid', () => {
// service.findAll(keys[0], serviceTokens[0], resourceID, paginationOptions, sortOptions).take(1).subscribe(entry => result = entry); spyOn(store, 'select').and.returnValue(Observable.of(validCacheEntry(keys[1])));
// expect(result.key).toEqual(keys[0]); expect(service.has(keys[1])).toBe(true);
// }); });
// });
// }); it('should return false if the request with the supplied key isn\'t cached', () => {
// spyOn(store, 'select').and.returnValue(Observable.of(undefined));
// describe('findById', () => { expect(service.has(keys[1])).toBe(false);
// beforeEach(() => { });
// spyOn(service, 'get').and.callFake((key) => Observable.of({key: key}));
// }); it('should return false if the request with the supplied key is cached but has exceeded its time to live', () => {
// describe('if the key isn't cached', () => { spyOn(store, 'select').and.returnValue(Observable.of(invalidCacheEntry(keys[1])));
// beforeEach(() => { expect(service.has(keys[1])).toBe(false);
// spyOn(service, 'has').and.returnValue(false); });
// }); });
// it('should dispatch a FIND_BY_ID action with the key, service, and resourceID', () => { });
// service.findById(keys[0], serviceTokens[0], resourceID);
// expect(store.dispatch).toHaveBeenCalledWith(new ResponseCacheFindByIDAction(keys[0], serviceTokens[0], resourceID))
// });
// it('should return an observable of the newly cached request with the specified key', () => {
// let result: ResponseCacheEntry;
// service.findById(keys[0], serviceTokens[0], resourceID).take(1).subscribe(entry => result = entry);
// expect(result.key).toEqual(keys[0]);
// });
// });
// describe('if the key is already cached', () => {
// beforeEach(() => {
// spyOn(service, 'has').and.returnValue(true);
// });
// it('shouldn't dispatch anything', () => {
// service.findById(keys[0], serviceTokens[0], resourceID);
// expect(store.dispatch).not.toHaveBeenCalled();
// });
// it('should return an observable of the existing cached request with the specified key', () => {
// let result: ResponseCacheEntry;
// service.findById(keys[0], serviceTokens[0], resourceID).take(1).subscribe(entry => result = entry);
// expect(result.key).toEqual(keys[0]);
// });
// });
// });
//
// describe('get', () => {
// it('should return an observable of the cached request with the specified key', () => {
// spyOn(store, 'select').and.callFake((...args:Array<any>) => {
// return Observable.of(validCacheEntry(args[args.length - 1]));
// });
//
// let testObj: ResponseCacheEntry;
// service.get(keys[1]).take(1).subscribe(entry => testObj = entry);
// expect(testObj.key).toEqual(keys[1]);
// });
//
// it('should not return a cached request that has exceeded its time to live', () => {
// spyOn(store, 'select').and.callFake((...args:Array<any>) => {
// return Observable.of(invalidCacheEntry(args[args.length - 1]));
// });
//
// let getObsHasFired = false;
// const subscription = service.get(keys[1]).subscribe(entry => getObsHasFired = true);
// expect(getObsHasFired).toBe(false);
// subscription.unsubscribe();
// });
// });
//
// describe('has', () => {
// it('should return true if the request with the supplied key is cached and still valid', () => {
// spyOn(store, 'select').and.returnValue(Observable.of(validCacheEntry(keys[1])));
// expect(service.has(keys[1])).toBe(true);
// });
//
// it('should return false if the request with the supplied key isn't cached', () => {
// spyOn(store, 'select').and.returnValue(Observable.of(undefined));
// expect(service.has(keys[1])).toBe(false);
// });
//
// it('should return false if the request with the supplied key is cached but has exceeded its time to live', () => {
// spyOn(store, 'select').and.returnValue(Observable.of(invalidCacheEntry(keys[1])));
// expect(service.has(keys[1])).toBe(false);
// });
// });
// });

View File

@@ -4,7 +4,7 @@ import { MemoizedSelector, Store } from '@ngrx/store';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { ResponseCacheEntry } from './response-cache.reducer'; import { ResponseCacheEntry } from './response-cache.reducer';
import { hasNoValue, hasValue } from '../../shared/empty.util'; import { hasNoValue } from '../../shared/empty.util';
import { ResponseCacheRemoveAction, ResponseCacheAddAction } from './response-cache.actions'; import { ResponseCacheRemoveAction, ResponseCacheAddAction } from './response-cache.actions';
import { RestResponse } from './response-cache.models'; import { RestResponse } from './response-cache.models';
import { CoreState } from '../core.reducers'; import { CoreState } from '../core.reducers';
@@ -25,7 +25,6 @@ export class ResponseCacheService {
add(key: string, response: RestResponse, msToLive: number): Observable<ResponseCacheEntry> { add(key: string, response: RestResponse, msToLive: number): Observable<ResponseCacheEntry> {
if (!this.has(key)) { if (!this.has(key)) {
// this.store.dispatch(new ResponseCacheFindAllAction(key, service, scopeID, paginationOptions, sortOptions));
this.store.dispatch(new ResponseCacheAddAction(key, response, new Date().getTime(), msToLive)); this.store.dispatch(new ResponseCacheAddAction(key, response, new Date().getTime(), msToLive));
} }
return this.get(key); return this.get(key);

View File

@@ -1,11 +1,11 @@
import { ObjectCacheEffects } from './data/object-cache.effects'; import { ObjectCacheEffects } from './cache/object-cache.effects';
import { RequestCacheEffects } from './data/request-cache.effects'; import { ResponseCacheEffects } from './cache/response-cache.effects';
import { UUIDIndexEffects } from './index/uuid-index.effects'; import { UUIDIndexEffects } from './index/uuid-index.effects';
import { RequestEffects } from './data/request.effects'; import { RequestEffects } from './data/request.effects';
export const coreEffects = [ export const coreEffects = [
RequestCacheEffects, ResponseCacheEffects,
RequestEffects, RequestEffects,
ObjectCacheEffects, ObjectCacheEffects,
UUIDIndexEffects, UUIDIndexEffects,