How do you test Cmd update functions?
I want to write a test that says, "If update
called with GetData
msg, it returns (_, httpCmd)
. I'm not sure how to write this test. I know how to get the answer how (model, cmd)
, but I don't know how to parse cmd
to see what's inside it."
How do people test the response of cmd
their function update
?
source to share
As now, they are Cmd
opaque - you cannot see inside them.
There elm-testable
is one you can use, but it needs preparation on your part.
There is also a rewrite which, when done, will allow you to keep the original code and test it directly.
source to share