mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 14:33:03 +00:00
finished tests and docs
This commit is contained in:
20
src/app/core/cache/object-cache.reducer.spec.ts
vendored
20
src/app/core/cache/object-cache.reducer.spec.ts
vendored
@@ -20,6 +20,8 @@ class NullAction extends RemoveFromObjectCacheAction {
|
||||
}
|
||||
|
||||
describe('objectCacheReducer', () => {
|
||||
const requestUUID1 = '8646169a-a8fc-4b31-a368-384c07867eb1';
|
||||
const requestUUID2 = 'bd36820b-4bf7-4d58-bd80-b832058b7279';
|
||||
const selfLink1 = 'https://localhost:8080/api/core/items/1698f1d3-be98-4c51-9fd8-6bfedcbd59b7';
|
||||
const selfLink2 = 'https://localhost:8080/api/core/items/28b04544-1766-4e82-9728-c4e93544ecd3';
|
||||
const newName = 'new different name';
|
||||
@@ -31,18 +33,18 @@ describe('objectCacheReducer', () => {
|
||||
},
|
||||
timeAdded: new Date().getTime(),
|
||||
msToLive: 900000,
|
||||
requestHref: selfLink1,
|
||||
requestUUID: requestUUID1,
|
||||
patches: [],
|
||||
isDirty: false
|
||||
},
|
||||
[selfLink2]: {
|
||||
data: {
|
||||
self: selfLink2,
|
||||
self: requestUUID2,
|
||||
foo: 'baz'
|
||||
},
|
||||
timeAdded: new Date().getTime(),
|
||||
msToLive: 900000,
|
||||
requestHref: selfLink2,
|
||||
requestUUID: selfLink2,
|
||||
patches: [],
|
||||
isDirty: false
|
||||
}
|
||||
@@ -68,8 +70,8 @@ describe('objectCacheReducer', () => {
|
||||
const objectToCache = { self: selfLink1 };
|
||||
const timeAdded = new Date().getTime();
|
||||
const msToLive = 900000;
|
||||
const requestHref = 'https://rest.api/endpoint/selfLink1';
|
||||
const action = new AddToObjectCacheAction(objectToCache, timeAdded, msToLive, requestHref);
|
||||
const requestUUID = requestUUID1;
|
||||
const action = new AddToObjectCacheAction(objectToCache, timeAdded, msToLive, requestUUID);
|
||||
const newState = objectCacheReducer(state, action);
|
||||
|
||||
expect(newState[selfLink1].data).toEqual(objectToCache);
|
||||
@@ -81,8 +83,8 @@ describe('objectCacheReducer', () => {
|
||||
const objectToCache = { self: selfLink1, foo: 'baz', somethingElse: true };
|
||||
const timeAdded = new Date().getTime();
|
||||
const msToLive = 900000;
|
||||
const requestHref = 'https://rest.api/endpoint/selfLink1';
|
||||
const action = new AddToObjectCacheAction(objectToCache, timeAdded, msToLive, requestHref);
|
||||
const requestUUID = requestUUID1;
|
||||
const action = new AddToObjectCacheAction(objectToCache, timeAdded, msToLive, requestUUID);
|
||||
const newState = objectCacheReducer(testState, action);
|
||||
|
||||
/* tslint:disable:no-string-literal */
|
||||
@@ -96,8 +98,8 @@ describe('objectCacheReducer', () => {
|
||||
const objectToCache = { self: selfLink1 };
|
||||
const timeAdded = new Date().getTime();
|
||||
const msToLive = 900000;
|
||||
const requestHref = 'https://rest.api/endpoint/selfLink1';
|
||||
const action = new AddToObjectCacheAction(objectToCache, timeAdded, msToLive, requestHref);
|
||||
const requestUUID = requestUUID1;
|
||||
const action = new AddToObjectCacheAction(objectToCache, timeAdded, msToLive, requestUUID);
|
||||
deepFreeze(state);
|
||||
|
||||
objectCacheReducer(state, action);
|
||||
|
Reference in New Issue
Block a user