Skip to content

Commit

Permalink
Merge pull request #680 from DFE-Digital/bug/171450
Browse files Browse the repository at this point in the history
Added error for actual date fa signed required when funding agreement…
  • Loading branch information
sukhybhullar-nimble authored Jul 2, 2024
2 parents b172d3d + 2e4d19a commit d454f4e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,37 +78,41 @@ describe("Testing Funding agreement Task", () => {
.withDateTrustSignedFA("2","2","1999")
.clickContinue()
.errorForTrustSignedFADate().showsError("Year must be between 2000 and 2050")

.withDateTrustSignedFA("","","")

cy.log("Trust signed FA date validation")

cy.log("Expected date FA is signed on Secretary of State's behalf validation")

fundingAgreementEditPage
.withExpectedDate("2","ds","2050")
.clickContinue()
.errorForExpectedDate().showsError("Enter a date in the correct format")
.withExpectedDate("2","2","2090")
.clickContinue()
.errorForExpectedDate().showsError("Year must be between 2000 and 2050")
.withExpectedDate("2","2","1999")
.clickContinue()
.errorForExpectedDate().showsError("Year must be between 2000 and 2050")
.withExpectedDate("2","ds","2050")
.clickContinue()
.errorForExpectedDate().showsError("Enter a date in the correct format")
.withExpectedDate("2","2","2090")
.clickContinue()
.errorForExpectedDate().showsError("Year must be between 2000 and 2050")
.withExpectedDate("2","2","1999")
.clickContinue()
.errorForExpectedDate().showsError("Year must be between 2000 and 2050")
.withExpectedDate("","","")

cy.log("Expected date FA is signed on Secretary of State's behalf validation")

cy.log("Actual date FA was signed validation")

fundingAgreementEditPage
.uncheckFundingAgreementSigned()
.withDateFAWasSigned("2","ds","2050")
.clickContinue()
.errorForDateFAWasSigned().showsError("Enter a date in the correct format")
.withDateFAWasSigned("2","2","2090")
.clickContinue()
.errorForDateFAWasSigned().showsError("Year must be between 2000 and 2050")
.withDateFAWasSigned("2","2","1999")
.clickContinue()
.errorForDateFAWasSigned().showsError("Year must be between 2000 and 2050")
.checkFundingAgreementSigned()
.clickContinue()
.errorForDateFAWasSigned().showsError("Enter the actual date FA was signed")
.withDateFAWasSigned("2","ds","2050")
.clickContinue()
.errorForDateFAWasSigned().showsError("Enter a date in the correct format")
.withDateFAWasSigned("2","2","2090")
.clickContinue()
.errorForDateFAWasSigned().showsError("Year must be between 2000 and 2050")
.withDateFAWasSigned("2","2","1999")
.clickContinue()
.errorForDateFAWasSigned().showsError("Year must be between 2000 and 2050")

cy.log("Actual date FA was signed validation")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ public async Task<ActionResult> OnPost()
return Page();
}

if (FundingAgreementSigned == true && DateFAWasSigned.HasValue == false)
{
ModelState.AddModelError("date-fa-was-signed", "Enter the actual date FA was signed");
}

if (!ModelState.IsValid)
{
_errorService.AddErrors(ModelState.Keys, ModelState);
return Page();
}

try
{
var request = new UpdateProjectByTaskRequest()
Expand Down

0 comments on commit d454f4e

Please sign in to comment.