From d591ef27cc7e512db3afd9c58ae1de5298987680 Mon Sep 17 00:00:00 2001 From: David Ansah <45106722+ansahdavid@users.noreply.github.com> Date: Mon, 2 Sep 2024 09:31:32 +0100 Subject: [PATCH] SASS-9593: Renamed Task Title object for json validation purposes (#59) * SASS-9593: Renamed Task Title object for json validation purposes * SASS-9593: Renamed GiltEdged Task Title object for json validation purposes --- app/models/tasklist/TaskTitle.scala | 7 +++---- app/services/CommonTaskListService.scala | 4 ++-- test/models/taskList/TaskTitleSpec.scala | 16 ++++++++-------- test/services/CommonTaskListServiceSpec.scala | 4 ++-- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/app/models/tasklist/TaskTitle.scala b/app/models/tasklist/TaskTitle.scala index 55652c2..7217f46 100644 --- a/app/models/tasklist/TaskTitle.scala +++ b/app/models/tasklist/TaskTitle.scala @@ -27,10 +27,9 @@ object TaskTitle extends Enum[TaskTitle] with PlayJsonEnum[TaskTitle] { val values: IndexedSeq[TaskTitle] = findValues // UK Interest - case object BankAndBuildingSocieties extends TaskTitle("BankAndBuildingSocietiesTitle") + case object BanksAndBuilding extends TaskTitle("BanksAndBuildingTitle") case object TrustFundBond extends TaskTitle("TrustFundBondTitle") - case object GiltEdgedOrAccrued extends TaskTitle("GiltEdgedOrAccruedTitle") - -} \ No newline at end of file + case object GiltEdged extends TaskTitle("GiltEdgedTitle") +} diff --git a/app/services/CommonTaskListService.scala b/app/services/CommonTaskListService.scala index a089ce0..2144f70 100644 --- a/app/services/CommonTaskListService.scala +++ b/app/services/CommonTaskListService.scala @@ -77,13 +77,13 @@ class CommonTaskListService @Inject()(appConfig: AppConfig, s"${appConfig.personalFrontendBaseUrl}/update-and-submit-income-tax-return/personal-income/$taxYear/interest/check-interest-from-securities" val bankAndBuildingSocieties: Option[TaskListSectionItem] = interest.untaxedUkInterest.map(_ => - TaskListSectionItem(TaskTitle.BankAndBuildingSocieties, TaskStatus.Completed, Some(bankAndBuildingUrl))) + TaskListSectionItem(TaskTitle.BanksAndBuilding, TaskStatus.Completed, Some(bankAndBuildingUrl))) val trustFundBond: Option[TaskListSectionItem] = interest.taxedUkInterest.map(_ => TaskListSectionItem(TaskTitle.TrustFundBond, TaskStatus.Completed, Some(trustFundUrl))) val giltEdgedOrAccrued: Option[TaskListSectionItem] = savings.securities.map(_ => - TaskListSectionItem(TaskTitle.GiltEdgedOrAccrued, TaskStatus.Completed, Some(giltEdgeUrl))) + TaskListSectionItem(TaskTitle.GiltEdged, TaskStatus.Completed, Some(giltEdgeUrl))) Seq[Option[TaskListSectionItem]](bankAndBuildingSocieties, trustFundBond, giltEdgedOrAccrued).flatten } diff --git a/test/models/taskList/TaskTitleSpec.scala b/test/models/taskList/TaskTitleSpec.scala index 0919030..50ef65a 100644 --- a/test/models/taskList/TaskTitleSpec.scala +++ b/test/models/taskList/TaskTitleSpec.scala @@ -28,9 +28,9 @@ class TaskTitleSpec extends AnyFreeSpec with Matchers { "must contain the correct values" in { TaskTitle.values mustEqual Seq[TaskTitle]( - BankAndBuildingSocieties, + BanksAndBuilding, TrustFundBond, - GiltEdgedOrAccrued + GiltEdged ) } @@ -43,10 +43,10 @@ class TaskTitleSpec extends AnyFreeSpec with Matchers { "BankAndBuildingSocieties" - { "must parse to and from json" in { - val underTest = Json.toJson(BankAndBuildingSocieties) + val underTest = Json.toJson(BanksAndBuilding) - underTest.toString() mustBe s"\"$BankAndBuildingSocieties\"" - underTest.validate[TaskTitle] mustBe JsSuccess(BankAndBuildingSocieties, JsPath()) + underTest.toString() mustBe s"\"$BanksAndBuilding\"" + underTest.validate[TaskTitle] mustBe JsSuccess(BanksAndBuilding, JsPath()) } } @@ -63,10 +63,10 @@ class TaskTitleSpec extends AnyFreeSpec with Matchers { "GiltEdgedOrAccrued" - { "must parse to and from json" in { - val underTest = Json.toJson(GiltEdgedOrAccrued) + val underTest = Json.toJson(GiltEdged) - underTest.toString() mustBe s"\"$GiltEdgedOrAccrued\"" - underTest.validate[TaskTitle] mustBe JsSuccess(GiltEdgedOrAccrued, JsPath()) + underTest.toString() mustBe s"\"$GiltEdged\"" + underTest.validate[TaskTitle] mustBe JsSuccess(GiltEdged, JsPath()) } } } diff --git a/test/services/CommonTaskListServiceSpec.scala b/test/services/CommonTaskListServiceSpec.scala index 7a6f409..aeafbfb 100644 --- a/test/services/CommonTaskListServiceSpec.scala +++ b/test/services/CommonTaskListServiceSpec.scala @@ -58,11 +58,11 @@ class CommonTaskListServiceSpec extends TestSuite { val fullTaskSection: TaskListSection = TaskListSection(SectionTitle.InterestTitle, Some(List( - TaskListSectionItem(TaskTitle.BankAndBuildingSocieties, TaskStatus.Completed, + TaskListSectionItem(TaskTitle.BanksAndBuilding, TaskStatus.Completed, Some("http://localhost:9308/update-and-submit-income-tax-return/personal-income/1234/interest/check-interest")), TaskListSectionItem(TaskTitle.TrustFundBond, TaskStatus.Completed, Some("http://localhost:9308/update-and-submit-income-tax-return/personal-income/1234/interest/check-interest")), - TaskListSectionItem(TaskTitle.GiltEdgedOrAccrued, TaskStatus.Completed, + TaskListSectionItem(TaskTitle.GiltEdged, TaskStatus.Completed, Some("http://localhost:9308/update-and-submit-income-tax-return/personal-income/1234/interest/check-interest-from-securities")), )) )