It seems like with the way expect
works, it must always test pure code. What is the plan for testing non-pure code? I think I remember hearing something about mocking out Tasks at one point. That would make it so that the tests are effectively still pure. What if I need side effects in tests? For example, I was trying to think of how property-based testing would work since you’d need a way to generate randomness.
I don't know the details of how it will work, but the plan is to have expect-fx
for that
Also, for property based tests, I would assume eventually if they are wanted, they would be built into the language test runner. That way it can control the randomness (that or maybe done somehow through expect-fx
or similar.
And yeah, with the changes to Tasks, it should be able to mock and test them in pure roc, theoretcially with expect
Ah I hadn’t heard about expect-fx
, cool. Out of curiosity, are there any designs/examples of what mocking Tasks would look like?
@Richard Feldman do you have a doc for this? The effect interpreter stuff that enables task mocking?
yeah I don't have an example yet unfortunately, it's still WIP
Last updated: Jul 06 2025 at 12:14 UTC