I asked more or less the same question about a month ago and got no
responses:


https://www.reddit.com/r/elm/comments/593vua/how_to_test_the_complete_update_cycle/
    https://groups.google.com/d/msg/elm-discuss/634UXiZjRFQ/lVeDED1oBQAJ

The only practical answer right now seems to be to use elm-testable, though
I haven't actually tried it myself.

This feels like a real blind-spot in the elm ecosystem. The generation and
handling of Cmds is central to a properly functioning app, but there
doesn't seem to be any first-class way to test e.g. Update without driving
the entire app from the top-level.

On Mon, Nov 7, 2016 at 8:28 AM Simon <[email protected]> wrote:

> I've often worried about the commands bit.
> For the view side, you need to test that you are deriving the right data
> to render, while it is Evan that needs to test that, given certain data,
> expected DOM elements get produced?
>
>
> On Monday, 7 November 2016 07:44:36 UTC+1, Francesco Orsenigo wrote:
>
> How do you write unit tests to ensure that an `update : Msg -> Model -> (
> Model, Cmd Msg )` function is producing the correct commands?
> What if the function is supposed to produce several commands batched
> together?
>
> Same thing for a `view : Model -> Html Msg`.
> Suppose I want to test whether, given a particular model, it will display
> the correct number of list items.
> Do people write tests for this?
> Right now the only way to write this kind of tests I can think of is
> creating the whole html tree as I expect it to be rendered, and comparing
> it via == with the function output.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to