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
Add @@ withLiveClock
to documentation
#8843
base: series/2.x
Are you sure you want to change the base?
Conversation
@mobley-trent These comments are mostly not true. And, to the extent they are true, they are not relevant.
|
@jdegoes thanks for the insights. I think I covered that information in my comments. Is there something I missed ? |
docs/reference/test/installation.md
Outdated
@@ -24,3 +24,6 @@ println("""```scala""") | |||
println("""testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")""") | |||
println("""```""") | |||
``` | |||
|
|||
|
|||
**NOTE**: Default services were removed from the ZIO environment in ZIO 2.x and integrated into the ZIO runtime. This also brings some changes to the way we run tests using these services. In order to use the live version of these services in our tests, we can use some new helpful test aspects e.g `withLiveClock`, `withLiveConsole`, `withLiveRandom`, `withLiveSystem`, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of discussing changes in ZIO 2.x, focus on the current features. If you need to address changes, consider including them in the migration guides, such as "ZIO 2.x Migration Guide".
|
||
### Example 5 | ||
|
||
In ZIO 2.x, we can use the live `Clock` service from the ZIO runtime in our tests using the `withLiveClock` test aspect. This removes the need to advance `TestClock` manually in our tests: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In ZIO 2.x, we can use the live `Clock` service from the ZIO runtime in our tests using the `withLiveClock` test aspect. This removes the need to advance `TestClock` manually in our tests: | |
We can use the live `Clock` service from the ZIO runtime in our tests using the `withLiveClock` test aspect. This removes the need to advance `TestClock` manually in our tests: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removes the need to advance
TestClock
manually in our tests
Because we need to advance the clock both manually and lively, I suggest including a section that explains the difference between TestClock
and a live clock, and when it is appropriate to use a live clock and when test clocks for testing components.
I used this as reference @khajavi https://timpigden.github.io/_pages/zio-streams/SpeedingUpTime.html |
/claim #8735
closes #8735