Skip to content

Commit

Permalink
HIPP-1857: Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
victorarbuesmallada committed Jan 24, 2025
1 parent c0335d7 commit 2e16882
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resolvers += Resolver.typesafeRepo("releases")
resolvers += "HMRC-open-artefacts-maven" at "https://open.artefacts.tax.service.gov.uk/maven2"
resolvers += Resolver.url("HMRC-open-artefacts-ivy", url("https://open.artefacts.tax.service.gov.uk/ivy2"))(Resolver.ivyStylePatterns)

addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.22.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.24.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.5.0")
addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.5")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.2.1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.mockito.ArgumentMatchers.any
import org.mockito.Mockito.*
import org.scalatest.BeforeAndAfterEach
import org.scalatest.matchers.should.Matchers
import org.scalatest.prop.TableDrivenPropertyChecks
import org.scalatest.wordspec.AnyWordSpec
import org.scalatestplus.mockito.MockitoSugar
import uk.gov.hmrc.integrationcatalogue.config.AppConfig
Expand All @@ -31,8 +32,10 @@ import uk.gov.hmrc.integrationcatalogue.models.common.ApiType
import uk.gov.hmrc.integrationcatalogue.parser.oas.adapters.{ExtensionKeys, IntegrationCatalogueExtensions, OASExtensionsAdapter}
import uk.gov.hmrc.integrationcatalogue.testdata.{ApiTestData, OasTestData}

import java.time.ZonedDateTime

class OasExtensionsAdapterSpec extends AnyWordSpec
with Matchers with MockitoSugar with ApiTestData with OasTestData with BeforeAndAfterEach with ExtensionKeys with OASExtensionsAdapter {
with Matchers with MockitoSugar with ApiTestData with OasTestData with BeforeAndAfterEach with ExtensionKeys with OASExtensionsAdapter with TableDrivenPropertyChecks {

trait Setup {
val publisherRefValue = "SOMEREFERENCE"
Expand Down Expand Up @@ -385,6 +388,31 @@ class OasExtensionsAdapterSpec extends AnyWordSpec
}
}

"return Right when reviewed date is an accepted iso 8601 format" in new Setup {
forAll(Table(
"reviewDate",
"2025-01-23T01:12:23.34567889Z",
"2025-01-23T01:12:23.3456788Z",
"2025-01-23T01:12:23.345678Z",
"2025-01-23T01:12:23.34567Z",
"2025-01-23T01:12:23.3456Z",
"2025-01-23T01:12:23.345Z",
"2025-01-23T01:12:23.34Z",
"2025-01-23T01:12:23.3Z"
)){ reviewDate =>
val extensionValues = new util.HashMap[String, Object]() {{
put(REVIEWED_DATE_EXTENSION_KEY, reviewDate)
}}
val result: Either[NonEmptyList[String], IntegrationCatalogueExtensions] =
parseExtensions(generateInfoObject(extensionValues), Some(publisherRefValue), mockAppConfig)
result match {
case Left(_) => fail()
case Right(extensions) =>
extensions.reviewedDate shouldBe ZonedDateTime.parse(reviewDate).toInstant
}
}
}

"return Left when status reviewed date is not an accepted iso 8601 format" in new Setup {
val result: Either[NonEmptyList[String], IntegrationCatalogueExtensions] =
parseExtensions(generateInfoObject(extensionsWithBadReviewDateString), Some(publisherRefValue), mockAppConfig)
Expand Down

0 comments on commit 2e16882

Please sign in to comment.