Not sure if this helps, but I have a quick elm-18 sample app demonstrating
the Navigation
module: https://github.com/joshsz/elm_doc_spike/blob/master/elm/Routing/App.elm
Also curious about TDD in elm, looking forward to replies on that.
On Wednesday, March 15, 2017 at 7:55:27 AM UTC-4, Richard Wood wrote:
>
> In trying unit testing in Elm I found the examples online a bit simplistic
> or narrow. So I'm wondering if there are some good examples online
> somewhere of a full variety of unit tests that someone could point me to.
> Would like to get a feel for when to use them and whether TDD is doable
> with Elm.
>
> I could also use some specific help here:
> If I use the Navigation module and flags and want to test the initial
> setup then it seems I need to preset all the fields in the location and the
> flags object.
> \()->
> let
> flags = App.Flags "/path/"
>
> location = { href = ""
> , host = ""
> , hostname = ""
> , protocol = ""
> , origin = ""
> , port_ = ""
> , pathname = ""
> , search = ""
> , hash = ""
> , username = ""
> , password = ""
> }
>
> model = Tuple.first (App.init flags location)
> in
> Expect.equal model.page App.Home
>
> Is there a way to mock or leave out the location in this example or other
> simplification?
>
> In another example, I want to check a view section that I pass the main
> model to. I obviously don't want to set every property of the model so is
> there another way?
>
> Also, in that latter example is there an easy way to see if an html output
> contains a particular string?
>
> Any thoughts appreciated.
>
--
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.