ktonon / elm-test-extra / Fuzz.Extra

Extends Fuzz with more Fuzzers.

eitherOr : Fuzzer a -> Fuzzer a -> Fuzzer a

Combine two fuzzers.

fuzzMaybeInt : Fuzzer (Maybe Int)
fuzzMaybeInt =
    Fuzz.Extra.eitherOr
        (Fuzz.constant Nothing)
        (Fuzz.int |> Fuzz.map Just)

uniformOrCrash : List (Fuzzer a) -> Fuzzer a

Generates among the provided values with uniform distribution

Like Fuzz.frequencyOrCrash but with uniform distribution.

httpMethod : Fuzzer Method
httpMethod =
    [ GET, POST, PUT, DELETE, OPTIONS ]
        |> List.map Fuzz.constant
        |> uniformOrCrash

Same as for frequencyOrCrash: "This is useful in tests, where a crash will simply cause the test run to fail. There is no danger to a production system there."

stringMaxLength : Basics.Int -> Fuzzer String

Generates random printable ASCII with a maximum length.

sequence : List (Fuzzer a) -> Fuzzer (List a)

Sequence a list of fuzzers into a fuzzer of a list.

Deprecated

Do not use this. It will be deprecated in version 2.

union : List a -> a -> Shrinker a -> Fuzzer a

Create a fuzzer for a union type.

Deprecated: use uniformOrCrash