New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to test ? #486

leobenkel opened this Issue Dec 28, 2018 · 2 comments


None yet
2 participants
Copy link

leobenkel commented Dec 28, 2018


I have been writing a project using Scalaz-Zio and using IO[A] throughout the project.

However, I am puzzled on how to write test for it.

How do I use assert(true, ...) when my value is IO[Error, Boolean] ?

Or assert(HaveSucceed, ...) ?

Thank you.


This comment has been minimized.

Copy link

ghostdogpr commented Dec 28, 2018

If your test class extends RTS, you can use unsafeRunSync on your IO to run it and receive an ExitResult[E, A] when it's completed. You can then use pattern matching on the ExitResult (or use toEither) to check if it was a success or failure.

You can also use unsafeRun directly to get an A but it will throw an exception in case of error.


This comment has been minimized.

Copy link

leobenkel commented Dec 28, 2018

Thank you !

@leobenkel leobenkel closed this Dec 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment