From 1faf61906a7a95a8881e0735bf38e1376ee0811a Mon Sep 17 00:00:00 2001 From: Alexandre Garbe Date: Tue, 24 Dec 2024 10:15:59 +0100 Subject: [PATCH] fix(admin): it is no longer possible to validate a certification whithout having filled its additional information --- .../update-certification-page.cy.ts | 15 ++++++++++++--- .../certifications/[certificationId]/page.tsx | 5 ++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-page/update-certification-page.cy.ts b/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-page/update-certification-page.cy.ts index d3701e19e..78aed8a49 100644 --- a/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-page/update-certification-page.cy.ts +++ b/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-page/update-certification-page.cy.ts @@ -5,10 +5,12 @@ import certificationBPBoucher from "./fixtures/certification-bp-boucher.json"; function interceptCertification({ withPrerequisites, withDescription, + withadditionalInfo, withStatus, }: { withPrerequisites?: boolean; withDescription?: boolean; + withadditionalInfo?: boolean; withStatus?: CertificationStatus; }) { cy.intercept("POST", "/api/graphql", (req) => { @@ -54,6 +56,9 @@ function interceptCertification({ juryPlace: null, } : {})(), + additionalInfo: withadditionalInfo + ? { linkToReferential: "https://www.google.fr" } + : undefined, status: withStatus || certificationBPBoucher.data.getCertification.status, }, @@ -201,7 +206,7 @@ context("when i access the update certification page ", () => { context("validate certification", () => { it("validate button should be disable if description has not been complete", function () { - interceptCertification({}); + interceptCertification({ withadditionalInfo: true }); cy.admin( "/responsable-certifications/certifications/bf78b4d6-f6ac-4c8f-9e6b-d6c6ae9e891b", @@ -220,8 +225,11 @@ context("when i access the update certification page ", () => { .should("be.disabled"); }); - it("validate button should be enable if description has been complete", function () { - interceptCertification({ withDescription: true }); + it("validate button should be enable if description and additional information sections are complete", function () { + interceptCertification({ + withDescription: true, + withadditionalInfo: true, + }); cy.admin( "/responsable-certifications/certifications/bf78b4d6-f6ac-4c8f-9e6b-d6c6ae9e891b", @@ -243,6 +251,7 @@ context("when i access the update certification page ", () => { it.skip("validate button should not be visible if certification has been validate", function () { interceptCertification({ withDescription: true, + withadditionalInfo: true, withStatus: "VALIDE_PAR_CERTIFICATEUR", }); diff --git a/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/page.tsx b/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/page.tsx index 4383f3d78..7bd8d793c 100644 --- a/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/page.tsx +++ b/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/page.tsx @@ -110,6 +110,9 @@ const PageContent = ({ certification.availableAt && certification.expiresAt; + const canValidateCertification = + isDescriptionComplete && certification.additionalInfo; + return (

@@ -297,7 +300,7 @@ const PageContent = ({