diff --git a/lib/phoenix/test/channel_test.ex b/lib/phoenix/test/channel_test.ex index a8337b69b1..4ca2ccc997 100644 --- a/lib/phoenix/test/channel_test.ex +++ b/lib/phoenix/test/channel_test.ex @@ -692,6 +692,8 @@ defmodule Phoenix.ChannelTest do do: struct def __stringify__(%{} = params), do: Enum.into(params, %{}, &stringify_kv/1) + def __stringify__(params) when is_list(params), + do: Enum.map(params, &__stringify__/1) def __stringify__(other), do: other diff --git a/test/phoenix/test/channel_test.exs b/test/phoenix/test/channel_test.exs index fd7078a0fa..de69baf311 100644 --- a/test/phoenix/test/channel_test.exs +++ b/test/phoenix/test/channel_test.exs @@ -290,6 +290,12 @@ defmodule Phoenix.Test.ChannelTest do assert_reply ref, :ok, %{"resp" => "foo"} end + test "works with list data structures" do + {:ok, _, socket} = join(socket(UserSocket), Channel, "foo:ok") + ref = push(socket, "reply", %{req: [%{bar: "baz"}, %{bar: "foo"}]}) + assert_reply ref, :ok, %{"resp" => [%{"bar" => "baz"}, %{"bar" => "foo"}]} + end + test "receives async replies" do {:ok, _, socket} = join(socket(UserSocket), Channel, "foo:ok")