git.iko.soy/haskell-servant/servant-elm
on master help sign in
fix tests
98097b2Gergely Szabo
test/GenerateSpec.hs−6
@@ -70,12 +70,6 @@ spec = do
70 "import Url.Builder\n" <>
70 "import Url.Builder\n" <>
71 "import Json.Decode as J\n\n" <>
71 "import Json.Decode as J\n\n" <>
72 "type alias Book = {}\n\n" <>
72 "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" <>
79 "jsonDecBook = J.succeed {}\n\n"
73 "jsonDecBook = J.succeed {}\n\n"
80 )
74 )
81 , ( "test/elm-sources/postBooksSource.elm"
75 , ( "test/elm-sources/postBooksSource.elm"
test/elm-sources/getBooksByIdSource.elm+1−1
@@ -24,7 +24,7 @@ getBooksById capture_id toMsg =
24 , url =
24 , url =
25 Url.Builder.crossOrigin ""
25 Url.Builder.crossOrigin ""
26 [ "books"
26 [ "books"
27− , capture_id |> String.fromInt
27+ , (capture_id |> String.fromInt)
28 ]
28 ]
29 params
29 params
30 , body =
30 , body =
test/elm-sources/getBooksByTitleSource.elm+1−1
@@ -23,7 +23,7 @@ getBooksByTitle capture_title toMsg =
23 , url =
23 , url =
24 Url.Builder.crossOrigin ""
24 Url.Builder.crossOrigin ""
25 [ "books"
25 [ "books"
26− , capture_title
26+ , (capture_title)
27 ]
27 ]
28 params
28 params
29 , body =
29 , body =
test/elm-sources/getBooksSource.elm+5−9
@@ -7,13 +7,6 @@ import Json.Decode as J
7
7
8type alias Book = {}
8type alias Book = {}
9
9
10−maybeBoolToIntStr : Maybe Bool -> String
11−maybeBoolToIntStr mx =
12− case mx of
13− Nothing -> ""
14− Just True -> "1"
15− Just False -> "0"
16−
17jsonDecBook = J.succeed {}
10jsonDecBook = J.succeed {}
18
11
19getBooks : Bool -> (Maybe String) -> (Maybe Int) -> String -> (List (Maybe Bool)) -> (Result Http.Error ((List Book)) -> msg) -> Cmd msg
12getBooks : 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
29 , [ query_sort
22 , [ query_sort
30 |> Maybe.map (Url.Builder.string "sort") ]
23 |> Maybe.map (Url.Builder.string "sort") ]
31 , [ query_year
24 , [ query_year
32− |> Maybe.map (String.fromInt >> Url.Builder.string "year") ]
25+ |> Maybe.map (String.fromInt
26+ >> Url.Builder.string "year") ]
33 , [ Just query_category
27 , [ Just query_category
34 |> Maybe.map (Url.Builder.string "category") ]
28 |> Maybe.map (Url.Builder.string "category") ]
35 , query_filters
29 , query_filters
30+ |> List.map ((Maybe.map (\value -> if value then "1" else "0") >> Maybe.withDefault "")
36− |> List.map (\val -> Just (Url.Builder.string "filters[]" (maybeBoolToIntStr val)))
31+ >> Url.Builder.string "filters[]"
32+ >> Just)
37 ])
33 ])
38 in
34 in
39 Http.request
35 Http.request
test/elm-sources/getWithaheaderSource.elm+4−2
@@ -19,9 +19,11 @@ getWithaheader header_myStringHeader header_MyIntHeader header_MyRequiredStringH
19 , headers =
19 , headers =
20 List.filterMap identity
20 List.filterMap identity
21 [ Maybe.map (Http.header "myStringHeader") header_myStringHeader
21 [ Maybe.map (Http.header "myStringHeader") header_myStringHeader
22+ , Maybe.map (Http.header "MyIntHeader"
22− , Maybe.map (Http.header "MyIntHeader" << String.fromInt) header_MyIntHeader
23+ << String.fromInt) header_MyIntHeader
23 , Maybe.map (Http.header "MyRequiredStringHeader") (Just header_MyRequiredStringHeader)
24 , Maybe.map (Http.header "MyRequiredStringHeader") (Just header_MyRequiredStringHeader)
25+ , Maybe.map (Http.header "MyRequiredIntHeader"
24− , Maybe.map (Http.header "MyRequiredIntHeader" << String.fromInt) (Just header_MyRequiredIntHeader)
26+ << String.fromInt) (Just header_MyRequiredIntHeader)
25 ]
27 ]
26 , url =
28 , url =
27 Url.Builder.crossOrigin ""
29 Url.Builder.crossOrigin ""