Skip to content

Commit

Permalink
Merge pull request #103 from hmrc/DAC6-3209-validation-update
Browse files Browse the repository at this point in the history
DAC6-3209: Fix CheckYourAnswersValidator
  • Loading branch information
Vishakha1903 authored Sep 17, 2024
2 parents 84f4e20 + 561253e commit 24a708d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
18 changes: 8 additions & 10 deletions app/utils/CheckYourAnswersValidator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,14 @@ sealed trait AddFIValidator {

private[utils] def checkAddressMissingAnswers: Seq[Page] = (userAnswers.get(WhereIsFIBasedPage) match {
case Some(true) =>
checkPage(PostcodePage)
.orElse(
any(
checkPage(SelectedAddressLookupPage),
checkPage(UkAddressPage),
checkPage(IsThisAddressPage)
).map(
_ => PostcodePage
)
)
any(
checkPage(PostcodePage),
checkPage(SelectedAddressLookupPage),
checkPage(UkAddressPage),
checkPage(IsThisAddressPage)
).map(
_ => PostcodePage
)
case Some(false) => checkPage(NonUkAddressPage)
case _ => Some(WhereIsFIBasedPage)
}).toSeq
Expand Down
5 changes: 1 addition & 4 deletions test-utils/generators/UserAnswersGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,13 @@ trait UserAnswersGenerator extends UserAnswersEntryGenerators with TryValues {
missingAnswersArb(
fiNotRegistered,
Seq(
NameOfFinancialInstitutionPage,
FirstContactEmailPage,
FirstContactHavePhonePage,
FirstContactNamePage,
FirstContactPhoneNumberPage,
HaveGIINPage,
HaveUniqueTaxpayerReferencePage,
IsThisAddressPage,
PostcodePage,
SelectAddressPage,
UkAddressPage,
WhatIsGIINPage,
WhatIsUniqueTaxpayerReferencePage,
WhereIsFIBasedPage,
Expand Down
3 changes: 3 additions & 0 deletions test/utils/CheckYourAnswersValidatorSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class CheckYourAnswersValidatorSpec extends AnyFreeSpec with Matchers with Model
val result = CheckYourAnswersValidator(userAnswers).validate
result mustNot be(empty)
Set(
NameOfFinancialInstitutionPage,
FirstContactEmailPage,
FirstContactHavePhonePage,
FirstContactNamePage,
Expand All @@ -53,6 +54,8 @@ class CheckYourAnswersValidatorSpec extends AnyFreeSpec with Matchers with Model
IsThisAddressPage,
PostcodePage,
SelectAddressPage,
SelectedAddressLookupPage,
NonUkAddressPage,
UkAddressPage,
WhatIsGIINPage,
WhatIsUniqueTaxpayerReferencePage,
Expand Down

0 comments on commit 24a708d

Please sign in to comment.