Assert for multiple ports.

This commit is contained in:
Dillon Kearns 2020-10-11 09:25:37 -07:00
parent 56718bb708
commit bf68b2eb47

View File

@ -336,12 +336,11 @@ expectSuccess expectedRequests previous =
|> ProgramTest.expectOutgoingPortValues
"toJsPort"
(Codec.decoder ToJsPayload.successCodecNew)
(\value ->
case value of
[ portPayload ] ->
Dict.fromList
[ ( portPayload.route, portPayload.contentJson )
]
(\portPayloads ->
portPayloads
|> List.map
(\portPayload -> ( portPayload.route, portPayload.contentJson ))
|> Dict.fromList
|> Expect.equalDicts
(expectedRequests
|> List.map
@ -357,9 +356,6 @@ expectSuccess expectedRequests previous =
)
|> Dict.fromList
)
_ ->
Expect.fail ("Expected ports to be called once, but instead there were " ++ String.fromInt (List.length value) ++ " calls.")
)