Skip to content

Commit

Permalink
feat(api): 'Missing' issue missing when the control value has empty s…
Browse files Browse the repository at this point in the history
…tring (#7244)
  • Loading branch information
tatarco authored Dec 9, 2024
1 parent 64a1c99 commit ecd93b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ export class PrepareAndValidateContentUsecase {
let flatSanitizedControlValues: Record<string, unknown> = flattenJson(controlValues);
const controlValueToContentIssues: Record<string, ContentIssue[]> = {};

flatSanitizedControlValues = this.removeEmptyValuesFromMap(flatSanitizedControlValues);
this.overloadMissingRequiredValuesIssues(
defaultControlValues,
flatSanitizedControlValues,
controlValueToContentIssues
);

flatSanitizedControlValues = this.removeEmptyValuesFromMap(flatSanitizedControlValues);
flatSanitizedControlValues = this.removeIllegalValuesAndOverloadIssues(
flatSanitizedControlValues,
controlValueToValidPlaceholders,
Expand Down
14 changes: 14 additions & 0 deletions apps/api/src/app/workflows-v2/workflow.controller.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,20 @@ describe('Workflow Controller E2E API Testing', () => {
}
}
});
it('should show control value required when empty', async () => {
const { issues, status } = await createWorkflowAndReturnStepIssues(
{ steps: [{ ...buildInAppStep(), controlValues: { body: '' } }] },
0
);
expect(status, JSON.stringify(issues)).to.equal(WorkflowStatusEnum.ERROR);
expect(issues).to.be.ok;
if (issues.controls) {
expect(issues.controls?.body).to.be.ok;
if (issues.controls?.body) {
expect(issues.controls?.body[0].issueType).to.be.equal(StepContentIssueEnum.MISSING_VALUE);
}
}
});

it('should show digest control value issues when illegal value provided', async () => {
const steps = [{ ...buildDigestStep() }];
Expand Down

0 comments on commit ecd93b3

Please sign in to comment.