You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried to write a high-level test for the routing of my application, with the help of Time.diagram. It kinda looks like this snippet:
it('renders the right component',done=>{constTime=mockTimeSource();constDOM=mockDOMSource({});constroute$=Time.diagram('A--B--AB--');constComponentA=sources=>({DOM: Time.diagram('a-a')});constComponentB=sources=>({DOM: Time.diagram('bb')});constexpected=Time.diagram('a-abb-abb-');constactual=AppBuilder(ComponentA,ComponentB)({DOM, route$ }).DOM;Time.assertEqual(actual,expected);Time.run(done);});
The test surprisingly didn't pass, and I have started to suspect that Time.diagram was not behaving like I was expecting it to be. So I have written this test for flatten in time/test/xstream.ts to challenge my assumptions:
describe('flatten',()=>{it('works in combination with map and a stream factory',done=>{constTime=mockTimeSource();constinput=Time.diagram('-A-------B-------|').map(letter=>Time.diagram('x-x-x|'));constactual=input.flatten();constexpected=Time.diagram('-x-x-x---x-x-x---|');Time.assertEqual(actual,expected);Time.run(done);});});
Expected behavior:
As described above, I would expect the returned stream to match -x-x-x---x-x-x---|. Meaning that the stream returned by the mapper function starts emitting only when it starts being instantiated and consumed. That's at least my interpretation of how Time.diagram should work, I'm happy to discuss any reasons it shouldn't behave this way.
Actual behavior:
The stream actually returned is x-x-x------------| (where every x hides another one). This is again very surprising, because it means that the stream returned by Time.diagram has been able to emit events anterior to its instantiation.
I'm happy to help with the fix if this issue gets identified as a bug.
Versions of packages used:
@cycle/time at version 0.19.0
The text was updated successfully, but these errors were encountered:
Code to reproduce the issue:
I have tried to write a high-level test for the routing of my application, with the help of
Time.diagram
. It kinda looks like this snippet:The test surprisingly didn't pass, and I have started to suspect that
Time.diagram
was not behaving like I was expecting it to be. So I have written this test forflatten
intime/test/xstream.ts
to challenge my assumptions:Expected behavior:
As described above, I would expect the returned stream to match
-x-x-x---x-x-x---|
. Meaning that the stream returned by the mapper function starts emitting only when it starts being instantiated and consumed. That's at least my interpretation of howTime.diagram
should work, I'm happy to discuss any reasons it shouldn't behave this way.Actual behavior:
The stream actually returned is
x-x-x------------|
(where every x hides another one). This is again very surprising, because it means that the stream returned byTime.diagram
has been able to emit events anterior to its instantiation.I'm happy to help with the fix if this issue gets identified as a bug.
Versions of packages used:
@cycle/time
at version0.19.0
The text was updated successfully, but these errors were encountered: