-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
There seems to be a problem with the assertTrue macro when working with zio.Cause and contains.. I have to cast the element I'm looking for
compile error:
[error] /Users/domdorn/acme/jobs-service/src/test/scala/com/acme/project/jobs/adapters/outbound/persistence/slick/CalcRepositorySpec.scala:372:37: type mismatch;
[error] found : zio.test.TestArrow[Seq[zio.Cause[com.acme.project.jobs.business.api.RestartCalc.RestartCalcException.CalculationNotFoundException.type]],Boolean]
[error] required: zio.test.TestArrow[List[zio.Cause[com.acme.project.jobs.business.api.RestartCalc.RestartCalcException]],?]
[error] } yield assertTrue(r.failures.contains(zio.Cause.fail(CalculationNotFoundException)))
test-code not working:
for {
jobRepo <- ZIO.service[JobRepositoryImpl]
repo <- ZIO.service[CalcRepositoryImpl]
r <- repo.restartCalculation(c, u, JobId.random(), CalcId.random(), someTs).sandbox.cause
} yield assertTrue(r.failures.contains(zio.Cause.fail(CalculationNotFoundException)))
},test-code that is working
test("return a CalculationNotFound failure if job does not exist in"){
for {
jobRepo <- ZIO.service[JobRepositoryImpl]
repo <- ZIO.service[CalcRepositoryImpl]
r <- repo.restartCalculation(c, u, JobId.random(), CalcId.random(), someTs).sandbox.cause
} yield assertTrue(r.failures.contains(zio.Cause.fail(CalculationNotFoundException: RestartCalcException)))
},