2021-04-15 08:45:07 +00:00
|
|
|
package wow.doge.http4sdemo
|
|
|
|
|
2021-04-17 18:05:10 +00:00
|
|
|
import scala.concurrent.Future
|
|
|
|
|
2021-04-15 08:45:07 +00:00
|
|
|
import cats.syntax.all._
|
2021-04-17 18:05:10 +00:00
|
|
|
import io.odin.Logger
|
2021-04-15 08:45:07 +00:00
|
|
|
import io.odin.consoleLogger
|
|
|
|
import io.odin.fileLogger
|
|
|
|
import io.odin.syntax._
|
|
|
|
import monix.bio.Task
|
|
|
|
import monix.execution.Scheduler
|
|
|
|
import munit.TestOptions
|
|
|
|
|
|
|
|
trait MonixBioSuite extends munit.TaglessFinalSuite[Task] {
|
|
|
|
override protected def toFuture[A](f: Task[A]): Future[A] = {
|
|
|
|
implicit val s = Scheduler.global
|
|
|
|
f.runToFuture
|
|
|
|
}
|
|
|
|
|
|
|
|
def loggerFixture(fileName: Option[String] = None)(implicit
|
|
|
|
enc: sourcecode.Enclosing
|
|
|
|
) =
|
|
|
|
ResourceFixture(
|
|
|
|
consoleLogger[Task]().withAsync() |+| fileLogger[Task](
|
|
|
|
fileName.getOrElse(enc.value.split("#").head + ".log")
|
|
|
|
),
|
|
|
|
(
|
|
|
|
options: TestOptions,
|
|
|
|
value: Logger[Task]
|
2021-04-19 10:35:48 +00:00
|
|
|
) => Task.unit,
|
2021-04-15 08:45:07 +00:00
|
|
|
(_: Logger[Task]) => Task.unit
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|