test: add in-between assertions and more fixtures (#1224)

This commit is contained in:
Ali BARIN
2023-08-18 18:34:52 +02:00
committed by GitHub
parent dbe18dd100
commit cb06d3b0ae
10 changed files with 121 additions and 66 deletions

View File

@@ -71,17 +71,18 @@ function generateValidationSchema(substeps: ISubstep[]) {
substepArgumentValidations[key] = yup.mixed();
}
if (typeof substepArgumentValidations[key] === 'object' && (arg.type === 'string' || arg.type === 'dropdown')) {
if (
typeof substepArgumentValidations[key] === 'object' &&
(arg.type === 'string' || arg.type === 'dropdown')
) {
// if the field is required, add the required validation
if (required) {
substepArgumentValidations[key] = substepArgumentValidations[
key
]
substepArgumentValidations[key] = substepArgumentValidations[key]
.required(`${key} is required.`)
.test(
'empty-check',
`${key} must be not empty`,
(value: any) => !isEmpty(value),
(value: any) => !isEmpty(value)
);
}
@@ -166,7 +167,9 @@ export default function FlowStep(
const actionsOrTriggers: Array<ITrigger | IAction> =
(isTrigger ? app?.triggers : app?.actions) || [];
const actionOrTrigger = actionsOrTriggers?.find(({ key }) => key === step.key);
const actionOrTrigger = actionsOrTriggers?.find(
({ key }) => key === step.key
);
const substeps = actionOrTrigger?.substeps || [];
const handleChange = React.useCallback(({ step }: { step: IStep }) => {
@@ -187,7 +190,12 @@ export default function FlowStep(
);
if (!apps) {
return <CircularProgress sx={{ display: 'block', my: 2 }} />;
return (
<CircularProgress
data-test="step-circular-loader"
sx={{ display: 'block', my: 2 }}
/>
);
}
const onContextMenuClose = (event: React.SyntheticEvent) => {
@@ -279,7 +287,8 @@ export default function FlowStep(
step={step}
/>
{actionOrTrigger && substeps?.length > 0 &&
{actionOrTrigger &&
substeps?.length > 0 &&
substeps.map((substep: ISubstep, index: number) => (
<React.Fragment key={`${substep?.name}-${index}`}>
{substep.key === 'chooseConnection' && app && (
@@ -304,7 +313,11 @@ export default function FlowStep(
onSubmit={expandNextStep}
onChange={handleChange}
onContinue={onContinue}
showWebhookUrl={'showWebhookUrl' in actionOrTrigger ? actionOrTrigger.showWebhookUrl : false}
showWebhookUrl={
'showWebhookUrl' in actionOrTrigger
? actionOrTrigger.showWebhookUrl
: false
}
step={step}
/>
)}