Skip to content

Commit

Permalink
CatsEffectSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
d10xa committed Jan 7, 2025
1 parent 6967086 commit a492f1e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ lazy val `json-log-viewer` = crossProject(JSPlatform, JVMPlatform)
pomIncludeRepository := { _ => false },
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-effect" % "3.5.4",
"org.typelevel" %%% "munit-cats-effect" % "2.0.0" % Test,
"co.fs2" %%% "fs2-core" % fs2Version,
"co.fs2" %%% "fs2-io" % fs2Version,
"com.monovore" %%% "decline" % declineVersion,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package ru.d10xa.jsonlogviewer

import cats.effect.IO
import cats.effect.unsafe.implicits.*
import fs2.Stream
import munit.FunSuite
import munit.CatsEffectSuite

import java.time.ZonedDateTime
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.Failure
import scala.util.Success

class TimestampFilterTest extends FunSuite {
class TimestampFilterTest extends CatsEffectSuite {
test("filterTimestampAfter") {
val filter = TimestampFilter()
val t1 = pr("2023-09-17T19:10:01.132318Z")
Expand All @@ -24,11 +20,7 @@ class TimestampFilterTest extends FunSuite {
)
.compile
.toList
.unsafeToFuture()
.onComplete {
case Success(list) => assert(list == t2)
case Failure(exception) => fail(exception.getMessage)
}
.flatTap(list => IO(assertEquals(list, List(t2))))
}

def pr(ts: String): ParseResult = ParseResult(
Expand Down

0 comments on commit a492f1e

Please sign in to comment.