refactored resource type and type mapping

This commit is contained in:
lotte
2019-06-24 16:29:54 +02:00
parent b846384ba7
commit f980b55c1c
101 changed files with 440 additions and 427 deletions

View File

@@ -9,7 +9,7 @@ import {
ResetObjectCacheTimestampsAction
} from './object-cache.actions';
import { Operation } from 'fast-json-patch';
import { ResourceType } from '../shared/resource-type';
import { Item } from '../shared/item.model';
class NullAction extends RemoveFromObjectCacheAction {
type = null;
@@ -29,7 +29,7 @@ describe('objectCacheReducer', () => {
const testState = {
[selfLink1]: {
data: {
type: ResourceType.Item,
type: Item.type,
self: selfLink1,
foo: 'bar'
},
@@ -41,7 +41,7 @@ describe('objectCacheReducer', () => {
},
[selfLink2]: {
data: {
type: ResourceType.Item,
type: Item.type,
self: requestUUID2,
foo: 'baz'
},
@@ -70,7 +70,7 @@ describe('objectCacheReducer', () => {
it('should add the payload to the cache in response to an ADD action', () => {
const state = Object.create(null);
const objectToCache = { self: selfLink1, type: ResourceType.Item };
const objectToCache = { self: selfLink1, type: Item.type };
const timeAdded = new Date().getTime();
const msToLive = 900000;
const requestUUID = requestUUID1;
@@ -87,7 +87,7 @@ describe('objectCacheReducer', () => {
self: selfLink1,
foo: 'baz',
somethingElse: true,
type: ResourceType.Item
type: Item.type
};
const timeAdded = new Date().getTime();
const msToLive = 900000;
@@ -103,7 +103,7 @@ describe('objectCacheReducer', () => {
it('should perform the ADD action without affecting the previous state', () => {
const state = Object.create(null);
const objectToCache = { self: selfLink1, type: ResourceType.Item };
const objectToCache = { self: selfLink1, type: Item.type };
const timeAdded = new Date().getTime();
const msToLive = 900000;
const requestUUID = requestUUID1;