diff --git a/examples/external-data/elm.json b/examples/external-data/elm.json index 87373855..2eaa7af9 100644 --- a/examples/external-data/elm.json +++ b/examples/external-data/elm.json @@ -28,6 +28,7 @@ "lukewestby/elm-string-interpolate": "1.0.4", "mdgriffith/elm-markup": "3.0.1", "mdgriffith/elm-ui": "1.1.5", + "mgold/elm-nonempty-list": "4.0.2", "miniBill/elm-codec": "1.2.0", "noahzgordon/elm-color-extra": "1.0.2", "rtfeldman/elm-hex": "1.0.0", @@ -36,6 +37,7 @@ "indirect": { "elm/bytes": "1.0.8", "elm/file": "1.0.5", + "elm/random": "1.0.0", "elm/regex": "1.0.0", "elm/time": "1.0.0", "elm/virtual-dom": "1.0.2", @@ -46,8 +48,6 @@ "direct": { "elm-explorations/test": "1.2.2" }, - "indirect": { - "elm/random": "1.0.0" - } + "indirect": {} } } \ No newline at end of file diff --git a/src/StaticHttp.elm b/src/StaticHttp.elm index f7bcc8c0..a823b7b3 100644 --- a/src/StaticHttp.elm +++ b/src/StaticHttp.elm @@ -271,7 +271,7 @@ reducedJsonRequest url decoder = |> Json.Decode.Exploration.decodeString decoder -- |> Result.mapError Json.Decode.Exploration.errorsToString |> (\decodeResult -> - case decodeResult |> Debug.log "decodeResult" of + case decodeResult of Json.Decode.Exploration.BadJson -> Pages.StaticHttpRequest.DecoderError "" |> Err diff --git a/tests/StaticHttpRequestsTests.elm b/tests/StaticHttpRequestsTests.elm index 14fec2a2..66be64ea 100644 --- a/tests/StaticHttpRequestsTests.elm +++ b/tests/StaticHttpRequestsTests.elm @@ -143,37 +143,36 @@ all = } ] ) - , only <| - test "reduced JSON is sent out" <| - \() -> - start - [ ( [] - , StaticHttp.reducedJsonRequest "https://api.github.com/repos/dillonkearns/elm-pages" (Reduce.field "stargazer_count" Reduce.int) - ) - ] - |> ProgramTest.simulateHttpOk - "GET" - "https://api.github.com/repos/dillonkearns/elm-pages" - """{ "stargazer_count": 86, "unused_field": 123 }""" - |> ProgramTest.expectOutgoingPortValues - "toJsPort" - (Codec.decoder Main.toJsCodec) - (Expect.equal - [ Main.Success - { pages = - Dict.fromList - [ ( "/" - , Dict.fromList - [ ( "https://api.github.com/repos/dillonkearns/elm-pages" - , """{"stargazer_count":86}""" - ) - ] - ) - ] - , manifest = manifest - } - ] - ) + , test "reduced JSON is sent out" <| + \() -> + start + [ ( [] + , StaticHttp.reducedJsonRequest "https://api.github.com/repos/dillonkearns/elm-pages" (Reduce.field "stargazer_count" Reduce.int) + ) + ] + |> ProgramTest.simulateHttpOk + "GET" + "https://api.github.com/repos/dillonkearns/elm-pages" + """{ "stargazer_count": 86, "unused_field": 123 }""" + |> ProgramTest.expectOutgoingPortValues + "toJsPort" + (Codec.decoder Main.toJsCodec) + (Expect.equal + [ Main.Success + { pages = + Dict.fromList + [ ( "/" + , Dict.fromList + [ ( "https://api.github.com/repos/dillonkearns/elm-pages" + , """{"stargazer_count":86}""" + ) + ] + ) + ] + , manifest = manifest + } + ] + ) , test "the port sends out even if there are no http requests" <| \() -> start