git.iko.soy/haskell-servant/servant-elm
on master help sign in
fix tests
commit98097b251d5068d1fe351264e157f658ab94f9ad authorGergely Szabo <gege251@gmail.com> dateSun 8 Sep 2019, 21:12 (7 years ago) parentd920d8b
5 files changed+11−19
test/GenerateSpec.hs−6 test/elm-sources/getBooksByIdSource.elm+1−1 test/elm-sources/getBooksByTitleSource.elm+1−1 test/elm-sources/getBooksSource.elm+5−9 test/elm-sources/getWithaheaderSource.elm+4−2
test/GenerateSpec.hs−6
@@ -70,12 +70,6 @@ spec = do
7070 "import Url.Builder\n" <>
7171 "import Json.Decode as J\n\n" <>
7272 "type alias Book = {}\n\n" <>
73− "maybeBoolToIntStr : Maybe Bool -> String\n" <>
74− "maybeBoolToIntStr mx =\n" <>
75− " case mx of\n" <>
76− " Nothing -> \"\"\n" <>
77− " Just True -> \"1\"\n" <>
78− " Just False -> \"0\"\n\n" <>
7973 "jsonDecBook = J.succeed {}\n\n"
8074 )
8175 , ( "test/elm-sources/postBooksSource.elm"
test/elm-sources/getBooksByIdSource.elm+1−1
@@ -24,7 +24,7 @@ getBooksById capture_id toMsg =
2424 , url =
2525 Url.Builder.crossOrigin ""
2626 [ "books"
27− , capture_id |> String.fromInt
27+ , (capture_id |> String.fromInt)
2828 ]
2929 params
3030 , body =
test/elm-sources/getBooksByTitleSource.elm+1−1
@@ -23,7 +23,7 @@ getBooksByTitle capture_title toMsg =
2323 , url =
2424 Url.Builder.crossOrigin ""
2525 [ "books"
26− , capture_title
26+ , (capture_title)
2727 ]
2828 params
2929 , body =
test/elm-sources/getBooksSource.elm+5−9
@@ -7,13 +7,6 @@ import Json.Decode as J
77
88type alias Book = {}
99
10−maybeBoolToIntStr : Maybe Bool -> String
11−maybeBoolToIntStr mx =
12− case mx of
13− Nothing -> ""
14− Just True -> "1"
15− Just False -> "0"
16−
1710jsonDecBook = J.succeed {}
1811
1912getBooks : Bool -> (Maybe String) -> (Maybe Int) -> String -> (List (Maybe Bool)) -> (Result Http.Error ((List Book)) -> msg) -> Cmd msg
@@ -29,11 +22,14 @@ getBooks query_published query_sort query_year query_category query_filters toMs
2922 , [ query_sort
3023 |> Maybe.map (Url.Builder.string "sort") ]
3124 , [ query_year
32− |> Maybe.map (String.fromInt >> Url.Builder.string "year") ]
25+ |> Maybe.map (String.fromInt
26+ >> Url.Builder.string "year") ]
3327 , [ Just query_category
3428 |> Maybe.map (Url.Builder.string "category") ]
3529 , query_filters
36− |> List.map (\val -> Just (Url.Builder.string "filters[]" (maybeBoolToIntStr val)))
30+ |> List.map ((Maybe.map (\value -> if value then "1" else "0") >> Maybe.withDefault "")
31+ >> Url.Builder.string "filters[]"
32+ >> Just)
3733 ])
3834 in
3935 Http.request
test/elm-sources/getWithaheaderSource.elm+4−2
@@ -19,9 +19,11 @@ getWithaheader header_myStringHeader header_MyIntHeader header_MyRequiredStringH
1919 , headers =
2020 List.filterMap identity
2121 [ Maybe.map (Http.header "myStringHeader") header_myStringHeader
22− , Maybe.map (Http.header "MyIntHeader" << String.fromInt) header_MyIntHeader
22+ , Maybe.map (Http.header "MyIntHeader"
23+ << String.fromInt) header_MyIntHeader
2324 , Maybe.map (Http.header "MyRequiredStringHeader") (Just header_MyRequiredStringHeader)
24− , Maybe.map (Http.header "MyRequiredIntHeader" << String.fromInt) (Just header_MyRequiredIntHeader)
25+ , Maybe.map (Http.header "MyRequiredIntHeader"
26+ << String.fromInt) (Just header_MyRequiredIntHeader)
2527 ]
2628 , url =
2729 Url.Builder.crossOrigin ""