Fix issues with type badges in tests

This commit is contained in:
Yana De Pauw
2020-12-08 13:30:31 +01:00
parent 1cc9349608
commit 52d11932cb
2 changed files with 23 additions and 2 deletions

View File

@@ -33,6 +33,21 @@ export abstract class TypedObject {
type: ResourceType;
}
/**
* Get the string value for an object that may be a string or a ResourceType
*
* @param type the object to get the type value for
*/
export const getResourceTypeValueFor = (type: any): string => {
if (hasValue(type)) {
if (typeof type === 'string') {
return type;
} else if (typeof type.value === 'string') {
return type.value;
}
}
}
/* tslint:disable:max-classes-per-file */
/**
* An interface to represent objects that can be cached