added tests, aot fixes, lint fixes

This commit is contained in:
lotte
2019-10-15 15:58:40 +02:00
parent bafb2f3490
commit 7ca88021c9
68 changed files with 749 additions and 651 deletions

View File

@@ -1,10 +1,10 @@
import { MetadataRepresentationType } from '../../core/shared/metadata-representation/metadata-representation.model';
import { hasNoValue, hasValue } from '../empty.util';
import { Context } from '../../core/shared/context.model';
import { Item } from '../../core/shared/item.model';
const map = new Map();
export const map = new Map();
export const DEFAULT_ENTITY_TYPE = 'Publication';
export const DEFAULT_REPRESENTATION_TYPE = MetadataRepresentationType.PlainText;
export const DEFAULT_CONTEXT = Context.Undefined;
@@ -13,7 +13,6 @@ export function metadataRepresentationComponent(entityType: string, mdRepresenta
if (hasNoValue(map.get(entityType))) {
map.set(entityType, new Map());
}
if (hasNoValue(map.get(entityType).get(mdRepresentationType))) {
map.get(entityType).set(mdRepresentationType, new Map());
}
@@ -37,7 +36,9 @@ export function getMetadataRepresentationComponent(entityType: string, mdReprese
return entityAndMDRepMap.get(DEFAULT_CONTEXT);
}
}
return mapForEntity.get(DEFAULT_REPRESENTATION_TYPE).get(DEFAULT_CONTEXT);
if (hasValue(mapForEntity.get(DEFAULT_REPRESENTATION_TYPE))) {
return mapForEntity.get(DEFAULT_REPRESENTATION_TYPE).get(DEFAULT_CONTEXT);
}
}
return map.get(Item.name).get(DEFAULT_REPRESENTATION_TYPE).get(DEFAULT_CONTEXT);
}
return map.get(DEFAULT_ENTITY_TYPE).get(DEFAULT_REPRESENTATION_TYPE).get(DEFAULT_CONTEXT);
}