I'm not aware of any really good examples of full webapp tests; maybe it's 
time to write some? That said,

Have you see strategies for effective testing 
<https://github.com/elm-community/elm-test#strategies-for-effective-testing>? 
It's been updated a bit on master since the last release.

Is there a way to mock or leave out the location in this example or other 
> simplification?


You don't have to use Expect.equal, and you can write your own expectation 
functions using Expect.pass and Expect.fail. But it sounds like App.init 
needs a big record that you don't want to pass, but you want to call 
App.init. So you may need to refactor that function.

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?


Instead of

type alias Model = { foo : Foo, bar : Bar }

view : Model -> Html Msg
view { foo } = -- code that ignores bar

-- try

view : {a| foo : Foo} -> Html Msg
view { foo } = -- same code

This syntax means the view function accepts any record as long as it has 
the stated field. It can have extra fields, like Model, or not, like a test 
mock. As a bonus, this will make fuzz shrinking much more effective because 
only relevant fields will need to be shrunk.

Also, in that latter example is there an easy way to see if an html output 
> contains a particular string? 


elm-html-test  
<http://package.elm-lang.org/packages/eeue56/elm-html-test/latest>

-- 
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