-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #292 from guardian/drop-specs2-for-scalatest
Drop Specs2, consolidate on ScalaTest
- Loading branch information
Showing
21 changed files
with
217 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 16 additions & 16 deletions
32
facia-json/src/test/scala/com/gu/facia/client/ApiClientSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
package com.gu.facia.client | ||
|
||
import org.specs2.mutable.Specification | ||
import scala.concurrent.Future | ||
import scala.concurrent.Await | ||
import com.gu.facia.client.lib.ResourcesHelper | ||
import scala.concurrent.duration.Duration | ||
import org.scalatest.OptionValues | ||
import org.scalatest.concurrent.{IntegrationPatience, ScalaFutures} | ||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
import scala.concurrent.ExecutionContext.Implicits.global | ||
import scala.concurrent.Future | ||
|
||
class ApiClientSpec extends Specification { | ||
class ApiClientSpec extends AnyFlatSpec with Matchers with OptionValues with ScalaFutures with IntegrationPatience { | ||
object FakeS3Client extends S3Client with ResourcesHelper { | ||
override def get(bucket: String, path: String): Future[FaciaResult] = Future { | ||
slurpOrDie(path) | ||
} | ||
} | ||
|
||
val client = ApiClient("not used", "DEV", FakeS3Client) | ||
val client: ApiClient = ApiClient("not used", "DEV", FakeS3Client) | ||
|
||
"ApiClient" should { | ||
"fetch the config" in { | ||
/** Nasty. PlaySpecification gives you a way of avoiding using Await ... TODO, maybe import that? */ | ||
val config = Await.result(client.config, Duration.Inf) | ||
"ApiClient" should "fetch the config" in { | ||
val config = client.config.futureValue | ||
|
||
(config.collections.size mustEqual 334) and (config.fronts.size mustEqual 79) | ||
} | ||
config.collections should have size 334 | ||
config.fronts should have size 79 | ||
} | ||
|
||
"fetch a collection" in { | ||
val collection = Await.result(client.collection("2409-31b3-83df0-de5a"), Duration.Inf) | ||
it should "fetch a collection" in { | ||
val collectionOpt = client.collection("2409-31b3-83df0-de5a").futureValue | ||
|
||
collection must beSome.which(_.live must haveLength(8)) | ||
} | ||
collectionOpt.value.live should have size 8 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.