Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
guizmaii committed Nov 14, 2024
1 parent b0e41a8 commit 48bc71d
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions magnum-zio/src/test/scala/ZioPgTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ZioPgTests extends FunSuite, TestContainersFixtures:

def runIO[A](io: ZIO[Any, Throwable, A]): A =
Unsafe.unsafe { implicit unsafe =>
runtime.unsafe.run(io).getOrThrowFiberFailure()
runtime.unsafe.run(io).getOrThrow()
}

/*
Expand Down Expand Up @@ -442,15 +442,24 @@ class ZioPgTests extends FunSuite, TestContainersFixtures:
isAdmin = false,
socialId = None
)
val count =
val countBefore =
runIO:
transact(dataSource):
try
personRepo.insert(p)
throw RuntimeException()
fail("should not reach")
catch case _: Exception => personRepo.count
assertEquals(count, 8L)
personRepo.count
try
runIO:
transact(dataSource):
personRepo.insert(p)
throw RuntimeException()
fail("should not reach")
catch
case _: RuntimeException => ()
val countAfter =
runIO:
connect(dataSource):
personRepo.count
assertEquals(countBefore, 8L)
assertEquals(countBefore, countAfter)

test("custom insert"):
val p = PersonCreator(
Expand Down

0 comments on commit 48bc71d

Please sign in to comment.