From bf68b2eb47700510c4d509760d60d8dde896d45e Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Sun, 11 Oct 2020 09:25:37 -0700 Subject: [PATCH] Assert for multiple ports. --- tests/BetaStaticHttpRequestsTests.elm | 40 ++++++++++++--------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/tests/BetaStaticHttpRequestsTests.elm b/tests/BetaStaticHttpRequestsTests.elm index b8046021..14a08cc7 100644 --- a/tests/BetaStaticHttpRequestsTests.elm +++ b/tests/BetaStaticHttpRequestsTests.elm @@ -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 + ) )