Skip to content

Commit

Permalink
ADR-1357 Amend spirits and ingredients months (#208)
Browse files Browse the repository at this point in the history
* ADR-1227 Fix test data

* ADR-1357 Amend spirits and ingredients months
  • Loading branch information
davidfes authored Nov 12, 2024
1 parent 5da747d commit e304839
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion app/config/Constants.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ object Constants {

val paddingBottomCssClass = "govuk-body govuk-!-padding-bottom-3"

val quarterlySpiritsMonths = Set(MARCH, JUNE, SEPTEMBER, DECEMBER)
val quarterlySpiritsMonths = Set(JANUARY, APRIL, JULY, OCTOBER)

val pastPaymentsSessionKey: String = "past-payment-amount"
}
24 changes: 12 additions & 12 deletions test-utils/common/TestData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,27 +74,27 @@ trait TestData extends ModelGenerators {
}

val quarterReturnPeriods = Set(
ReturnPeriod(YearMonth.of(2024, Month.MARCH)),
ReturnPeriod(YearMonth.of(2024, Month.JUNE)),
ReturnPeriod(YearMonth.of(2024, Month.SEPTEMBER)),
ReturnPeriod(YearMonth.of(2024, Month.DECEMBER))
ReturnPeriod(YearMonth.of(2024, Month.JANUARY)),
ReturnPeriod(YearMonth.of(2024, Month.APRIL)),
ReturnPeriod(YearMonth.of(2024, Month.JULY)),
ReturnPeriod(YearMonth.of(2024, Month.OCTOBER))
)
val nonQuarterReturnPeriods =
Set(
ReturnPeriod(YearMonth.of(2024, Month.JANUARY)),
ReturnPeriod(YearMonth.of(2024, Month.FEBRUARY)),
ReturnPeriod(YearMonth.of(2024, Month.APRIL)),
ReturnPeriod(YearMonth.of(2024, Month.MARCH)),
ReturnPeriod(YearMonth.of(2024, Month.MAY)),
ReturnPeriod(YearMonth.of(2024, Month.JULY)),
ReturnPeriod(YearMonth.of(2024, Month.JUNE)),
ReturnPeriod(YearMonth.of(2024, Month.AUGUST)),
ReturnPeriod(YearMonth.of(2024, Month.OCTOBER)),
ReturnPeriod(YearMonth.of(2024, Month.NOVEMBER))
ReturnPeriod(YearMonth.of(2024, Month.SEPTEMBER)),
ReturnPeriod(YearMonth.of(2024, Month.NOVEMBER)),
ReturnPeriod(YearMonth.of(2024, Month.DECEMBER))
)

val nonQuarterReturnPeriodGen = Gen.oneOf(nonQuarterReturnPeriods.toSeq)
val quarterReturnPeriodGen = Gen.oneOf(quarterReturnPeriods.toSeq)

val returnPeriodMar = ReturnPeriod.fromPeriodKey(periodKeyMar).get
val returnPeriodJan = ReturnPeriod.fromPeriodKey(periodKeyJan).get

val emptyUserAnswers: UserAnswers = UserAnswers(
returnId,
Expand Down Expand Up @@ -131,7 +131,7 @@ trait TestData extends ModelGenerators {
regimes = AlcoholRegimes(Set(OtherFermentedProduct))
)
val userAnswersWithoutOtherFermentedProduct: UserAnswers = emptyUserAnswers.copy(
regimes = AlcoholRegimes(Set(Beer, Spirits))
regimes = AlcoholRegimes(Set(Beer, Cider, Wine, Spirits))
)

val userAnswersWithAllRegimes: UserAnswers = emptyUserAnswers.copy(
Expand Down Expand Up @@ -943,7 +943,7 @@ trait TestData extends ModelGenerators {
val fullRepackageAdjustmentEntry: AdjustmentEntry = AdjustmentEntry(
index = Some(0),
adjustmentType = Some(AdjustmentType.RepackagedDraughtProducts),
period = Some(returnPeriodMar.period),
period = Some(returnPeriodJan.period),
rateBand = Some(
RateBand(
taxTypeCode = "001",
Expand Down
4 changes: 2 additions & 2 deletions test/controllers/returns/ViewReturnControllerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ class ViewReturnControllerSpec extends SpecBase {
}

class SetUp {
val periodKey = periodKeyMar
val periodKey = periodKeyJan
val returnDetails = exampleReturnDetails(periodKey, Instant.now(clock))
val returnDetailsWithBadPeriodKey =
returnDetails.copy(identification = returnDetails.identification.copy(periodKey = badPeriodKey))
val returnPeriodStr = dateTimeHelper.formatMonthYear(returnPeriodMar.period)
val returnPeriodStr = dateTimeHelper.formatMonthYear(returnPeriodJan.period)
val submittedAtDateStr = dateTimeHelper.formatDateMonthYear(
dateTimeHelper.instantToLocalDate(returnDetails.identification.submittedTime)
)
Expand Down
4 changes: 2 additions & 2 deletions test/models/ReturnPeriodSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ class ReturnPeriodSpec extends SpecBase {
ReturnPeriod.fromPeriodKey("24AC").get.periodToDate() mustBe LocalDate.of(2024, 3, 31)
}

Seq("24AC", "24AF", "24AI", "24AL").foreach { periodKey =>
Seq("24AA", "24AD", "24AG", "24AJ").foreach { periodKey =>
s"$periodKey should have quarterly spirits" in {
ReturnPeriod.fromPeriodKey(periodKey).get.hasQuarterlySpirits mustBe true
}
}

Seq("24AA", "24AB", "24AD", "24AE", "24AG", "24AH", "24AJ", "24AK").foreach { periodKey =>
Seq("24AB", "24AC", "24AE", "24AF", "24AH", "24AI", "24AK", "24AL").foreach { periodKey =>
s"$periodKey should not have quarterly spirits" in {
ReturnPeriod.fromPeriodKey(periodKey).get.hasQuarterlySpirits mustBe false
}
Expand Down
12 changes: 6 additions & 6 deletions test/viewmodels/tasklist/AlcoholDutyTaskListHelperSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class AlcoholDutyTaskListHelperSpec extends SpecBase with ScalaCheckPropertyChec
)

val result =
taskListViewModel.getTaskList(emptyUserAnswers, validUntil, returnPeriodMar)(getMessages(application))
taskListViewModel.getTaskList(emptyUserAnswers, validUntil, returnPeriodJan)(getMessages(application))
val validUntilString = validUntil.toLocalDateString()

result mustBe AlcoholDutyTaskList(
Expand Down Expand Up @@ -81,7 +81,7 @@ class AlcoholDutyTaskListHelperSpec extends SpecBase with ScalaCheckPropertyChec
)

val result =
taskListViewModel.getTaskList(userAnswers, validUntil, returnPeriodMar)(getMessages(application))
taskListViewModel.getTaskList(userAnswers, validUntil, returnPeriodJan)(getMessages(application))
val validUntilString = validUntil.toLocalDateString()

result mustBe AlcoholDutyTaskList(
Expand All @@ -94,7 +94,7 @@ class AlcoholDutyTaskListHelperSpec extends SpecBase with ScalaCheckPropertyChec
result.completedTasks mustBe 4
}

"must return a the quarter spirits task only in Mar, Jun, Sep and Dec" in new SetUp {
"must return a the quarter spirits task only in Jan, Apr, Jul and Oct" in new SetUp {
val expectedSectionsWithQS = Seq(
returnTaskListCreator.returnSection(emptyUserAnswers),
returnTaskListCreator.returnAdjustmentSection(emptyUserAnswers),
Expand All @@ -116,10 +116,10 @@ class AlcoholDutyTaskListHelperSpec extends SpecBase with ScalaCheckPropertyChec
val result =
taskListViewModel.getTaskList(emptyUserAnswers, validUntil, returnPeriod)(getMessages(application))

val periodQuarters = "CFIL"
val lastChar = periodKey.last
val periodQuarterChars = Set('A', 'D', 'G', 'J')
val lastChar = periodKey.last

if (periodQuarters.contains(lastChar)) {
if (periodQuarterChars.contains(lastChar)) {
result.sections mustBe expectedSectionsWithQS
} else {
result.sections mustBe expectedSectionsWithoutQS
Expand Down
6 changes: 3 additions & 3 deletions test/viewmodels/tasklist/TaskListViewModelSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class TaskListViewModelSpec extends SpecBase {
when(mockReturnTaskListCreator.returnQSSection(emptyUserAnswers)).thenReturn(completeSection)
when(mockReturnTaskListCreator.returnCheckAndSubmitSection(1, 4)).thenReturn(cannotStartSection)

val result = taskListViewModel.getTaskList(emptyUserAnswers, validUntil, returnPeriodMar)
val result = taskListViewModel.getTaskList(emptyUserAnswers, validUntil, returnPeriodJan)

result mustBe AlcoholDutyTaskList(
Seq(notStartedSection, notStartedSection, inProgressSection, completeSection, cannotStartSection),
Expand All @@ -58,7 +58,7 @@ class TaskListViewModelSpec extends SpecBase {
when(mockReturnTaskListCreator.returnQSSection(emptyUserAnswers)).thenReturn(completeSection)
when(mockReturnTaskListCreator.returnCheckAndSubmitSection(4, 4)).thenReturn(notStartedSection)

val result = taskListViewModel.getTaskList(emptyUserAnswers, validUntil, returnPeriodMar)
val result = taskListViewModel.getTaskList(emptyUserAnswers, validUntil, returnPeriodJan)

result mustBe AlcoholDutyTaskList(
Seq(completeSection, completeSection, completeSection, completeSection, notStartedSection),
Expand All @@ -77,7 +77,7 @@ class TaskListViewModelSpec extends SpecBase {
when(mockReturnTaskListCreator.returnQSSection(emptyUserAnswers)).thenReturn(completeSection)
when(mockReturnTaskListCreator.returnCheckAndSubmitSection(0, 3)).thenReturn(cannotStartSection)

val result = taskListViewModel.getTaskList(emptyUserAnswers, validUntil, returnPeriodMar)
val result = taskListViewModel.getTaskList(emptyUserAnswers, validUntil, returnPeriodJan)

result mustBe AlcoholDutyTaskList(
Seq(notStartedSection, notStartedSection, inProgressSection, cannotStartSection),
Expand Down

0 comments on commit e304839

Please sign in to comment.