Fuzz cat name in route test.

This commit is contained in:
Dillon Kearns 2021-04-28 13:04:20 -07:00
parent a0af3dba38
commit 709d11ef6b

View File

@ -4,6 +4,7 @@ import Expect
import Fuzz exposing (Fuzzer)
import Route exposing (Route)
import Test exposing (Test, describe, fuzz, test)
import Url
all : Test
@ -54,7 +55,9 @@ all =
routeFuzzer : Fuzzer Route
routeFuzzer =
Fuzz.oneOf
[ Fuzz.constant (Route.Cats__Name__ { name = Just "larry" })
[ Fuzz.map
(\string -> Route.Cats__Name__ { name = Just string })
nonEmptyUrlEscapedString
, Fuzz.int
|> Fuzz.map
(\number ->
@ -77,3 +80,17 @@ routeFuzzer =
Fuzz.int
(Fuzz.list Fuzz.int)
]
nonEmptyUrlEscapedString : Fuzzer String
nonEmptyUrlEscapedString =
Fuzz.map2
(\c string ->
Url.percentEncode
(String.fromChar
c
++ string
)
)
Fuzz.char
Fuzz.string