Skip to content

Commit

Permalink
Fixed* failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherjturner committed Mar 26, 2019
1 parent b1f041f commit 2f7bb21
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions test/uk/gov/hmrc/cataloguefrontend/ServicePageSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class ServicePageSpec extends UnitSpec with GuiceOneServerPerSuite with WireMock

override def beforeEach(): Unit = {
super.beforeEach()
FeatureSwitch.disable(CatalogueFrontendSwitches.indicators)
serviceEndpoint(GET, "/reports/repositories", willRespondWith = (200, Some("[]")))
serviceEndpoint(GET, "/frontend-route/service-1", willRespondWith = (200, Some(configServiceService1)))
serviceEndpoint(GET, "/frontend-route/service-name", willRespondWith = (200, Some(configServiceService1)))
Expand Down Expand Up @@ -258,6 +259,7 @@ class ServicePageSpec extends UnitSpec with GuiceOneServerPerSuite with WireMock
}

"Render a message if the indicators service returns 404" in {
FeatureSwitch.enable(CatalogueFrontendSwitches.indicators)
val today = LocalDateTime.now
val dayInterval = createdAt.until(today, ChronoUnit.DAYS) + 1

Expand All @@ -277,6 +279,7 @@ class ServicePageSpec extends UnitSpec with GuiceOneServerPerSuite with WireMock
}

"Render a message if the indicators service encounters an error" in {
FeatureSwitch.enable(CatalogueFrontendSwitches.indicators)
serviceEndpoint(GET, "/api/repositories/service-name", willRespondWith = (200, Some(serviceDetailsData)))
serviceEndpoint(GET, "/api/indicators/service/service-name/deployments", willRespondWith = (500, None))
serviceEndpoint(
Expand Down
1 change: 1 addition & 0 deletions test/uk/gov/hmrc/cataloguefrontend/TeamServicesSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class TeamServicesSpec extends UnitSpec with BeforeAndAfter with GuiceOneServerP

override def beforeEach(): Unit = {
super.beforeEach()
FeatureSwitch.disable(CatalogueFrontendSwitches.indicators)
serviceEndpoint(GET, "/reports/repositories", willRespondWith = (200, Some("[]")))
serviceEndpoint(GET, "/api/teams/teamA/dependencies", willRespondWith = (200, Some("[]")))
serviceEndpoint(GET, "/api/teams/CATO/dependencies", willRespondWith = (200, Some("[]")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ package uk.gov.hmrc.cataloguefrontend.connector

import org.mockito.Matchers._
import org.mockito.Mockito._
import org.scalatest._
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.mockito.MockitoSugar
import uk.gov.hmrc.http.{BadGatewayException, HeaderCarrier}
import uk.gov.hmrc.play.bootstrap.config.ServicesConfig
import uk.gov.hmrc.play.bootstrap.http.HttpClient
import uk.gov.hmrc.play.test.UnitSpec

import scala.concurrent.{ExecutionContext, Future}

class LeakDetectionConnectorSpec extends WordSpec with Matchers with ScalaFutures with MockitoSugar {
class LeakDetectionConnectorSpec extends UnitSpec with MockitoSugar {
import ExecutionContext.Implicits.global

"repositoriesWithLeaks" should {
Expand All @@ -42,7 +42,7 @@ class LeakDetectionConnectorSpec extends WordSpec with Matchers with ScalaFuture

val leakDetectionConnector = new LeakDetectionConnector(httpClient, servicesConfig)

leakDetectionConnector.repositoriesWithLeaks.futureValue shouldBe Seq.empty
await( leakDetectionConnector.repositoriesWithLeaks ) shouldBe Seq.empty
}
}
}

0 comments on commit 2f7bb21

Please sign in to comment.