aux-search/frontend/tests/Example.elm

52 lines
1.3 KiB
Elm
Raw Permalink Normal View History

2020-03-28 04:09:01 +00:00
module Example exposing (fuzzTest, unitTest, viewTest)
import Expect
import Fuzz exposing (int)
2020-03-28 04:09:01 +00:00
import Test exposing (..)
import Test.Html.Query as Query
import Test.Html.Selector exposing (tag, text)
{-| See <https://github.com/elm-explorations/test>
2020-03-28 04:09:01 +00:00
-}
unitTest : Test
unitTest =
describe "simple unit test"
[ test "Inc adds one" <|
\() ->
update Inc (Model 0 "")
|> Tuple.first
|> .counter
|> Expect.equal 1
]
{-| See <https://github.com/elm-explorations/test>
2020-03-28 04:09:01 +00:00
-}
fuzzTest : Test
fuzzTest =
describe "simple fuzz test"
[ fuzz int "Inc ALWAYS adds one" <|
\ct ->
update Inc (Model ct "")
|> Tuple.first
|> .counter
|> Expect.equal (ct + 1)
]
{-| see <https://github.com/eeue56/elm-html-test>
-}
viewTest : Test
viewTest =
describe "Testing view function"
[ test "Button has the expected text" <|
\() ->
Model 0 ""
|> view
|> Query.fromHtml
|> Query.findAll [ tag "button" ]
|> Query.first
|> Query.has [ text "+ 1" ]
]