Skip to content

Commit

Permalink
MCSC-1188 User Sees 15/16 as a Single Period (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelAAbbott authored Nov 20, 2024
1 parent ea14cec commit 2a9dbcf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
10 changes: 8 additions & 2 deletions app/pages/annualallowance/taxyear/WhichSchemePage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ case class WhichSchemePage(period: Period, schemeIndex: SchemeIndex) extends Que
controllers.annualallowance.taxyear.routes.PensionSchemeDetailsController
.onPageLoad(NormalMode, period, schemeIndex)
case Some(_) =>
controllers.annualallowance.taxyear.routes.PensionSchemeInputAmountsController
.onPageLoad(NormalMode, period, schemeIndex)
period match {
case Period._2016 =>
controllers.annualallowance.taxyear.routes.PensionSchemeInput2016preAmountsController
.onPageLoad(NormalMode, period, schemeIndex)
case _ =>
controllers.annualallowance.taxyear.routes.PensionSchemeInputAmountsController
.onPageLoad(NormalMode, period, schemeIndex)
}
case None => controllers.routes.JourneyRecoveryController.onPageLoad(None)
}
}
Expand Down
11 changes: 10 additions & 1 deletion test/pages/annualallowance/taxyear/WhichSchemePageSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class WhichSchemeSpec extends PageBehaviours {

"normal mode navigation" - {

"when a scheme ref is specified capture input amounts" in {
"when a scheme ref is specified capture input amounts for 2017+ periods" in {
val userAnswers = emptyUserAnswers.set(WhichSchemePage(Period._2018, SchemeIndex(0)), "schemeRef").get

val nextPageUrl: String =
Expand All @@ -41,6 +41,15 @@ class WhichSchemeSpec extends PageBehaviours {
checkNavigation(nextPageUrl, "/annual-allowance/2018/pension-scheme-0/pension-input-amount")
}

"when a scheme ref is specified capture input amounts for 2016 period" in {
val userAnswers = emptyUserAnswers.set(WhichSchemePage(Period._2016, SchemeIndex(0)), "schemeRef").get

val nextPageUrl: String =
WhichSchemePage(Period._2016, SchemeIndex(0)).navigate(NormalMode, userAnswers).url

checkNavigation(nextPageUrl, "/annual-allowance/2016/pension-scheme-0/pension-input-amount-15-16-period-1")
}

"when a new scheme is indicated capture scheme details" in {
val userAnswers = emptyUserAnswers.set(WhichSchemePage(Period._2018, SchemeIndex(0)), PSTR.New).get

Expand Down

0 comments on commit 2a9dbcf

Please sign in to comment.