You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProductExportRepositorySpec.scala 1.1KB

123456789101112131415161718192021222324252627282930
  1. package de.codingchallenge.repositories
  2. import akka.http.scaladsl.model.StatusCodes
  3. import akka.stream.scaladsl.{Sink, Source}
  4. import de.codingchallenge.fixtures.{ArticleFixture, ProductExportFixture}
  5. import de.codingchallenge.models.{Article, ProductExport}
  6. import de.codingchallenge.csv.CsvOps._
  7. import de.codingchallenge.{AkkaSpec, BaseSpec, models}
  8. import scala.concurrent.Await
  9. import scala.concurrent.duration._
  10. /**
  11. * Honestly this is kind of an integration tests running against the Demo Server
  12. */
  13. class ProductExportRepositorySpec extends BaseSpec with AkkaSpec with ProductExportFixture with ArticleFixture {
  14. "The ProductExportRepository" must {
  15. "put a single report" in {
  16. val repo = new ProductExportRepository(system)
  17. Await.result(repo.add(Source.single(productExport), 1), 2.second).status mustBe StatusCodes.OK
  18. }
  19. "put multiple reports" in {
  20. val repo = new ProductExportRepository(system)
  21. val articles = sampleData.map(_.csvToOptOf[Article].get).toList.map(e => models.ProductExport(e, 1))
  22. Await.result(repo.add(Source(articles), 1), 2.second).status mustBe StatusCodes.OK
  23. }
  24. }
  25. }