module PhotoGrooveTest exposing (..) import Expect exposing (Expectation) import Fuzz exposing (Fuzzer, int, list, string) import Json.Decode as J import Json.Encode as Encode exposing (Value) import PhotoGroove as Testee import Test exposing (..) suite : Test suite = describe "photoDecoder" [ fuzz2 Fuzz.string Fuzz.int "title always defaults to '(untitled)'" <| \url size -> mkPhoto url size |> J.decodeValue Testee.photoDecoder |> Result.map .title |> Expect.equal (Ok "(untitled)") ] mkPhoto : String -> Int -> Value mkPhoto url size = [ ( "url", Encode.string url ), ( "size", Encode.int size ) ] |> Encode.object