A purescript-halogen component has an eval
function defining how it evaluates queries. I'd like to write tests to cover the behaviour of the component; how would I go about doing this?
For instance, if my component has GetValue
in its query algebra, I'd like to write a test which creates the component with initial state, evaluates a GetValue
query, and asserts that the value received matches what was provided in the initial state. If my component also has a SetValue
, I might like to assert that evaluating a GetValue
after a SetValue
returns what I expect.
I can't find any examples of this sort of testing (I refer to Slamdata's code a lot but the only tests I see there are Selenium tests).
I feel like the solution must lie in Halogen.Component, where functions like queryComponent
and initializeComponent
reside; I've looked at the Halogen.Driver source to try to understand how to use them but I've been unable to figure it out.
Could someone either point me to an example of testing a Halogen component, or explain how one would be able to create a component, have it evaluate a query, and observe the results?