diff --git a/src/lib/getKcContext/getKcContext.ts b/src/lib/getKcContext/getKcContext.ts index ee0793b4..0ea97452 100644 --- a/src/lib/getKcContext/getKcContext.ts +++ b/src/lib/getKcContext/getKcContext.ts @@ -60,6 +60,8 @@ export function getKcContext { + console.log("====>", attribute); + const partialAttribute = partialAttributes.find(({ name }) => name === attribute.name); const augmentedAttribute: Attribute = {} as any; @@ -82,14 +84,16 @@ export function getKcContext(kcContext).profile.attributesByName[augmentedAttribute.name] = augmentedAttribute; }); - partialAttributes.forEach(partialAttribute => { - const { name } = partialAttribute; + partialAttributes + .map(partialAttribute => ({ "validators": {}, ...partialAttribute })) + .forEach(partialAttribute => { + const { name } = partialAttribute; - assert(name !== undefined, "If you define a mock attribute it must have at least a name"); + assert(name !== undefined, "If you define a mock attribute it must have at least a name"); - id(kcContext).profile.attributes.push(partialAttribute as any); - id(kcContext).profile.attributesByName[name] = partialAttribute as any; - }); + id(kcContext).profile.attributes.push(partialAttribute as any); + id(kcContext).profile.attributesByName[name] = partialAttribute as any; + }); } }