Integration testing v2 enum field types fail and success path (#14010)
# Introduction Migrating and improving performances of field enum integrations tests success and failing tests cases to be using the new v2 api ## Discovered issue When deleting an object in v1 it will leave related enums until the object is re-created Something not done anymore within the create in v2 but in the delete operation We should implem an upgrade command to remove such relicas ## Bugs - Update/create default value multi select runner wrong sql query -> FIX - Update default value multi select regression, we should allow option without an id to be inserted -> FIX - default value compare dynamic json stringify convertion or not in compare tools for object and fields
This commit is contained in:
+47
-10
@@ -45,12 +45,31 @@ const validateMetadataOptionId = (sanitizedId?: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
const validateMetadataOptionLabel = (sanitizedLabel: string) => {
|
||||
const validateMetadataOptionLabel = (
|
||||
sanitizedLabel: string,
|
||||
): FlatFieldMetadataValidationError[] => {
|
||||
if (!isDefined(sanitizedLabel)) {
|
||||
return [
|
||||
{
|
||||
code: FieldMetadataExceptionCode.INVALID_FIELD_INPUT,
|
||||
message: t`Option label is required`,
|
||||
userFriendlyMessage: t`Option label is required`,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
if (!isNonEmptyString(sanitizedLabel)) {
|
||||
return [
|
||||
{
|
||||
code: FieldMetadataExceptionCode.INVALID_FIELD_INPUT,
|
||||
message: t`Option label must be a string of at least one character`,
|
||||
userFriendlyMessage: t`Option label format not supported`,
|
||||
value: sanitizedLabel,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
const validators: FlatMetadataValidator<string>[] = [
|
||||
{
|
||||
validator: (label) => !isDefined(label),
|
||||
message: t`Option label is required`,
|
||||
},
|
||||
{
|
||||
validator: exceedsDatabaseIdentifierMaximumLength,
|
||||
message: t`Option label exceeds 63 characters`,
|
||||
@@ -75,12 +94,30 @@ const validateMetadataOptionLabel = (sanitizedLabel: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
const validateMetadataOptionValue = (sanitizedValue: string) => {
|
||||
const validateMetadataOptionValue = (
|
||||
sanitizedValue: string,
|
||||
): FlatFieldMetadataValidationError[] => {
|
||||
if (!isDefined(sanitizedValue)) {
|
||||
return [
|
||||
{
|
||||
code: FieldMetadataExceptionCode.INVALID_FIELD_INPUT,
|
||||
message: t`Option value is required`,
|
||||
userFriendlyMessage: t`Option value is required`,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
if (!isNonEmptyString(sanitizedValue)) {
|
||||
return [
|
||||
{
|
||||
code: FieldMetadataExceptionCode.INVALID_FIELD_INPUT,
|
||||
message: t`Option value must be a string of at least one character`,
|
||||
userFriendlyMessage: t`Option value format not supported`,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
const validators: FlatMetadataValidator<string>[] = [
|
||||
{
|
||||
validator: (value) => !isDefined(value),
|
||||
message: t`Option value is required`,
|
||||
},
|
||||
{
|
||||
validator: exceedsDatabaseIdentifierMaximumLength,
|
||||
message: t`Option value exceeds 63 characters`,
|
||||
|
||||
Reference in New Issue
Block a user