mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-24 20:31:42 +03:00
Assert for multiple ports.
This commit is contained in:
parent
56718bb708
commit
bf68b2eb47
@ -336,30 +336,26 @@ expectSuccess expectedRequests previous =
|
||||
|> ProgramTest.expectOutgoingPortValues
|
||||
"toJsPort"
|
||||
(Codec.decoder ToJsPayload.successCodecNew)
|
||||
(\value ->
|
||||
case value of
|
||||
[ portPayload ] ->
|
||||
Dict.fromList
|
||||
[ ( portPayload.route, portPayload.contentJson )
|
||||
]
|
||||
|> Expect.equalDicts
|
||||
(expectedRequests
|
||||
|> List.map
|
||||
(\( url, requests ) ->
|
||||
( url
|
||||
, requests
|
||||
|> List.map
|
||||
(\( request, response ) ->
|
||||
( Request.hash request, response )
|
||||
)
|
||||
|> Dict.fromList
|
||||
(\portPayloads ->
|
||||
portPayloads
|
||||
|> List.map
|
||||
(\portPayload -> ( portPayload.route, portPayload.contentJson ))
|
||||
|> Dict.fromList
|
||||
|> Expect.equalDicts
|
||||
(expectedRequests
|
||||
|> List.map
|
||||
(\( url, requests ) ->
|
||||
( url
|
||||
, requests
|
||||
|> List.map
|
||||
(\( request, response ) ->
|
||||
( Request.hash request, response )
|
||||
)
|
||||
)
|
||||
|> Dict.fromList
|
||||
|> Dict.fromList
|
||||
)
|
||||
)
|
||||
|
||||
_ ->
|
||||
Expect.fail ("Expected ports to be called once, but instead there were " ++ String.fromInt (List.length value) ++ " calls.")
|
||||
|> Dict.fromList
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user