Make it allright not to provide validators object on mock data

This commit is contained in:
garronej 2022-09-04 23:19:33 +02:00
parent 6d9e62d2b4
commit e4a46f31de

View File

@ -60,6 +60,8 @@ export function getKcContext<KcContextExtended extends { pageId: string } = neve
].filter(exclude(undefined));
attributes.forEach(attribute => {
console.log("====>", attribute);
const partialAttribute = partialAttributes.find(({ name }) => name === attribute.name);
const augmentedAttribute: Attribute = {} as any;
@ -82,7 +84,9 @@ export function getKcContext<KcContextExtended extends { pageId: string } = neve
id<KcContextBase.RegisterUserProfile>(kcContext).profile.attributesByName[augmentedAttribute.name] = augmentedAttribute;
});
partialAttributes.forEach(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");