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.

51 lines
1.4 KiB

3 years ago
  1. package wow.doge.http4sdemo
  2. import com.dimafeng.testcontainers.PostgreSQLContainer
  3. import monix.bio.IO
  4. import monix.bio.UIO
  5. import wow.doge.http4sdemo.services.LibraryDbio
  6. import wow.doge.http4sdemo.services.LibraryServiceImpl
  7. class LibrarySpec2 extends DatabaseIntegrationTestBase {
  8. override def afterContainersStart(containers: Containers): Unit = {
  9. createSchema(containers)
  10. }
  11. test("blah") {
  12. withContainers {
  13. case postgresContainer: PostgreSQLContainer =>
  14. val io =
  15. withDb(postgresContainer.jdbcUrl)(db =>
  16. for {
  17. // _ <- db.runL(Tables.schema.create)
  18. _ <- UIO.unit
  19. service = new LibraryServiceImpl(
  20. profile,
  21. new LibraryDbio(profile),
  22. db
  23. )
  24. _ <- service
  25. .getBookById(1)
  26. .hideErrors
  27. .flatMap(r => UIO(println(r)))
  28. } yield ()
  29. )
  30. io
  31. case other =>
  32. IO.terminate(new Exception(s"Invalid container ${other.toString}"))
  33. }
  34. }
  35. // override val container: PostgreSQLContainer = PostgreSQLContainer()
  36. // "PostgreSQL container" should "be started" in {
  37. // Class.forName(container.driverClassName)
  38. // val connection = DriverManager.getConnection(
  39. // container.jdbcUrl,
  40. // container.username,
  41. // container.password
  42. // )
  43. // // ...
  44. // }
  45. }