-
Notifications
You must be signed in to change notification settings - Fork 29
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
Testing #24
Comments
I'm interested in what you think about this @jayrbolton. Do you think this is useful for testing FRP code? How do you normally test such code? |
I've always tested flyd code with manual pushes and reads. The way I've thought about before to do it less imperatively is very similar to your example there, where you have a special test stream constructor where you can manually order each value. I wonder if this could also be good for documentation examples. In documentation, it's nice to show how the values change over time with real values without resorting to imperative push/read. I also wonder: if you treat the keys as milliseconds, could you test time-based stream logic declaratively? I think I need more experience with Hareactive and more intuition about One thought: I've always wanted to try to implement QuickCheck from Haskell in javascript. I think something like that could be applied here. For example, the resulting stream has these properties that could be automatically tested:
|
Then we've had the same thought process. The goal here is exactly to make tests more compact and pure.
Yes! I think that is a very good idea. It will make examples much more compact and thus more easy to read. Maybe it can also be used to power diagrams like (RxMarbles)[http://rxmarbles.com/).
Yes. We support that in
That would be very cool! And probably also very useful. Besides supporting more thorough testing, one would also avoid creating the test streams and have the quickcheck library do it. I'm aware that jsverify exists but I've never used it. |
Does |
Yes, indeed. On a behavior it returns export type Occurrence<A> = {
time: Time,
value: A
};
export type SemanticStream<A> = Occurrence<A>[] For testing the basic idea is this: put semantic streams and behaviors into your system/function and you will get semantic streams and behaviors out. You declare your semantic streams/behaviors by giving their full history and the semantic streams/behaviors you get out in the end also contain a full history. You can then test that the results match the expected. This makes is possible to test FRP code in a way that is completely declarative, synchronous and free from side effects. I'm quite excited about the feature as reactive libraries can often be hard to test. I do however think that we still need some more helper functions in order to make the testing is easy as possible. |
@paldepind It may be just me, but I felt quite confused by the name I find the analogy with Physics as mentioned in The
I probably would call the |
Testing FRP code can sometimes be tricky and cumbersome.
To solve the problem we are working on a way to FRP code in a way that is declarative and convenient.
Here is a simple example. Let's say one want's to test this function:
Currently, such a function can be tested like this:
The testing feature is currently quite incomplete. And we completely lack a way to test code that uses
Now
. I think testingNow
could be achieved by combining elements from how testing IO works and how testing behavior/streams work.This issue is for discussion ideas and problems related to testing.
The text was updated successfully, but these errors were encountered: