Apply some elm-review fixes.

This commit is contained in:
Dillon Kearns 2022-01-27 16:03:42 -08:00
parent a03b0295bc
commit 9619e3e199
6 changed files with 25 additions and 26 deletions

View File

@ -53,7 +53,6 @@
"noahzgordon/elm-color-extra": "1.0.2 <= v < 2.0.0", "noahzgordon/elm-color-extra": "1.0.2 <= v < 2.0.0",
"robinheghan/murmur3": "1.0.0 <= v < 2.0.0", "robinheghan/murmur3": "1.0.0 <= v < 2.0.0",
"stil4m/elm-syntax": "7.2.7 <= v < 8.0.0", "stil4m/elm-syntax": "7.2.7 <= v < 8.0.0",
"tripokey/elm-fuzzy": "5.2.1 <= v < 6.0.0",
"turboMaCk/non-empty-list-alias": "1.2.0 <= v < 2.0.0", "turboMaCk/non-empty-list-alias": "1.2.0 <= v < 2.0.0",
"vito/elm-ansi": "10.0.1 <= v < 11.0.0" "vito/elm-ansi": "10.0.1 <= v < 11.0.0"
}, },

View File

@ -89,12 +89,12 @@ all =
) )
) )
|> literal "no-dynamic-segments.json" |> literal "no-dynamic-segments.json"
|> ApiRoute.serverRender |> serverRender
|> Internal.ApiRoute.toPattern |> Internal.ApiRoute.toPattern
|> Expect.equal (Pattern [ Pattern.Literal "no-dynamic-segments.json" ] Pattern.NoPendingSlash) |> Expect.equal (Pattern [ Pattern.Literal "no-dynamic-segments.json" ] Pattern.NoPendingSlash)
, test "two literal segments" <| , test "two literal segments" <|
\() -> \() ->
ApiRoute.succeed succeed
(Server.Request.succeed () (Server.Request.succeed ()
|> Server.Request.map |> Server.Request.map
(\() -> (\() ->
@ -103,10 +103,10 @@ all =
|> DataSource.succeed |> DataSource.succeed
) )
) )
|> ApiRoute.literal "api" |> literal "api"
|> ApiRoute.slash |> slash
|> ApiRoute.literal "stars" |> literal "stars"
|> ApiRoute.serverRender |> serverRender
|> Internal.ApiRoute.toPattern |> Internal.ApiRoute.toPattern
|> Expect.equal |> Expect.equal
(Pattern (Pattern
@ -154,12 +154,12 @@ all =
DataSource.succeed ("Data for repo " ++ repo |> Server.Response.plainText) DataSource.succeed ("Data for repo " ++ repo |> Server.Response.plainText)
) )
) )
|> ApiRoute.literal "api" |> literal "api"
|> ApiRoute.slash |> slash
|> ApiRoute.literal "repo" |> literal "repo"
|> ApiRoute.slash |> slash
|> ApiRoute.capture |> capture
|> ApiRoute.literal ".json" |> literal ".json"
|> serverRender |> serverRender
|> Internal.ApiRoute.toPattern |> Internal.ApiRoute.toPattern
|> Expect.equal |> Expect.equal

View File

@ -1,6 +1,6 @@
module FormDataTest exposing (all) module FormDataTest exposing (all)
import Dict exposing (Dict) import Dict
import Expect import Expect
import FormData import FormData
import Test exposing (Test, describe, test) import Test exposing (Test, describe, test)

View File

@ -5,7 +5,7 @@ import Dict
import Expect import Expect
import Form import Form
import Form.Value import Form.Value
import Test exposing (Test, describe, only, skip, test) import Test exposing (Test, describe, skip, test)
import Time import Time
@ -117,7 +117,7 @@ all =
|> Form.withInitialValue (Date.fromCalendarDate 2022 Time.Jan 1 |> Form.Value.date) |> Form.withInitialValue (Date.fromCalendarDate 2022 Time.Jan 1 |> Form.Value.date)
) )
|> Form.validate |> Form.validate
(\( checkin, checkout ) -> (\_ ->
[ ( "checkin", [ "Must be before checkout date." ] ) [ ( "checkin", [ "Must be before checkout date." ] )
] ]
) )
@ -237,7 +237,7 @@ all =
|> Form.withInitialValue (Date.fromCalendarDate 2022 Time.Jan 1 |> Form.Value.date) |> Form.withInitialValue (Date.fromCalendarDate 2022 Time.Jan 1 |> Form.Value.date)
) )
|> Form.validate |> Form.validate
(\( checkin, checkout ) -> (\_ ->
[ ( "checkin", [ "Must be before checkout date." ] ) [ ( "checkin", [ "Must be before checkout date." ] )
] ]
) )
@ -377,7 +377,7 @@ expectErrorsAfterUpdates expected form =
|> List.map |> List.map
(\formModel () -> (\formModel () ->
formModel.fields formModel.fields
|> Dict.map (\key value -> value.errors) |> Dict.map (\_ value -> value.errors)
|> Expect.equalDicts (Dict.fromList expected) |> Expect.equalDicts (Dict.fromList expected)
) )
) )
@ -401,7 +401,7 @@ performUpdatesThenExpectErrors updatesToPerform expected form =
|> List.map |> List.map
(\formModel () -> (\formModel () ->
formModel.fields formModel.fields
|> Dict.map (\key value -> value.errors) |> Dict.map (\_ value -> value.errors)
|> Expect.equalDicts (Dict.fromList expected) |> Expect.equalDicts (Dict.fromList expected)
) )
) )

View File

@ -5,7 +5,7 @@ import Json.Decode
import Json.Encode import Json.Encode
import OptimizedDecoder import OptimizedDecoder
import Server.Request as Request import Server.Request as Request
import Test exposing (Test, describe, only, test) import Test exposing (Test, describe, test)
all : Test all : Test
@ -87,13 +87,13 @@ all =
\() -> \() ->
Request.oneOf Request.oneOf
[ Request.expectFormPost [ Request.expectFormPost
(\{ field, optionalField } -> (\{ field } ->
field "first" field "first"
) )
, Request.expectJsonBody (OptimizedDecoder.field "first" OptimizedDecoder.string) , Request.expectJsonBody (OptimizedDecoder.field "first" OptimizedDecoder.string)
, Request.expectQueryParam "first" , Request.expectQueryParam "first"
, Request.expectMultiPartFormPost , Request.expectMultiPartFormPost
(\{ field, optionalField } -> (\{ field } ->
field "first" field "first"
) )
] ]
@ -143,7 +143,7 @@ expectMatch request (Request.Request decoder) =
of of
Ok ok -> Ok ok ->
case ok of case ok of
( Ok inner, [] ) -> ( Ok _, [] ) ->
Expect.pass Expect.pass
( Err innerError, otherErrors ) -> ( Err innerError, otherErrors ) ->
@ -171,7 +171,7 @@ expectNoMatch request expectedErrorString (Request.Request decoder) =
of of
Ok ok -> Ok ok ->
case ok of case ok of
( Ok inner, [] ) -> ( Ok _, [] ) ->
Expect.fail "Expected this request not to match, but instead it did match." Expect.fail "Expected this request not to match, but instead it did match."
( Err innerError, otherErrors ) -> ( Err innerError, otherErrors ) ->

View File

@ -1,7 +1,7 @@
module SetCookieTest exposing (all) module SetCookieTest exposing (all)
import Expect import Expect
import Server.SetCookie as SetCookie exposing (..) import Server.SetCookie exposing (..)
import Test exposing (Test, describe, test) import Test exposing (Test, describe, test)
import Time import Time
@ -73,7 +73,7 @@ all =
\() -> \() ->
setCookie "id" "a3fWa" setCookie "id" "a3fWa"
|> nonSecure |> nonSecure
|> withSameSite SetCookie.Strict |> withSameSite Strict
|> toString |> toString
|> Expect.equal "id=a3fWa; SameSite=Strict" |> Expect.equal "id=a3fWa; SameSite=Strict"
] ]