defmodule Phoenix.Tranports.LongPollSerializerTest do
  use ExUnit.Case, async: true

  alias Phoenix.Transports.LongPollSerializer
  alias Phoenix.Socket.Message
  alias Phoenix.Socket.Broadcast
  alias Phoenix.Socket.Reply

  @msg_json [123, [[34, ["topic"], 34], 58, [34, ["t"], 34], 44, [34, ["ref"], 34], 58, "null", 44, [34, ["payload"], 34], 58, [34, ["m"], 34], 44, [34, ["event"], 34], 58, [34, ["e"], 34]], 125]

  test "fastlane!/1 translates `Phoenix.Socket.Broadcast` into 'Phoenix.Socket.Message'" do
    broadcast = %Broadcast{topic: "t", event: "e", payload: "m"}
    assert LongPollSerializer.fastlane!(broadcast) == %Message{topic: broadcast.topic, event: broadcast.event, payload: broadcast.payload}
  end

  test "encode!/1 encodes `Phoenix.Socket.Message` as JSON" do
    reply = %Reply{topic: "t", payload: "m", ref: "foo", status: "bar"}
    assert LongPollSerializer.encode!(reply) == %Message{topic: reply.topic, event: "phx_reply", ref: reply.ref, payload: %{status: reply.status, response: reply.payload}}
  end

  test "decode!/2 decodes `Phoenix.Socket.Message` from JSON" do
    assert %Message{topic: "t", event: "e", payload: "m"} ==
      LongPollSerializer.decode!(@msg_json, opcode: :text)
  end
end

Add test for long poll serializer
Add test for long poll serializer

(cherry picked from commit 86d52ec918ebad546f746e30db7745c3c06f0361)

keathley/phoenix,optikfluffel/phoenix,ericmj/phoenix,iStefo/phoenix,mschae/phoenix,optikfluffel/phoenix,eksperimental/phoenix,iStefo/phoenix,evax/phoenix,wsmoak/phoenix,CultivateHQ/phoenix,0x00evil/phoenix,jwarwick/phoenix,korobkov/phoenix,0x00evil/phoenix,rafbgarcia/phoenix,pap/phoenix,pap/phoenix,gjaldon/phoenix,nshafer/phoenix,trarbr/phoenix,CultivateHQ/phoenix,Gazler/phoenix,Gazler/phoenix,michalmuskala/phoenix,Joe-noh/phoenix,mschae/phoenix,cas27/phoenix,bsmr-erlang/phoenix,eksperimental/phoenix,phoenixframework/phoenix,keathley/phoenix,ericmj/phoenix,gjaldon/phoenix,michalmuskala/phoenix,rafbgarcia/phoenix,stevedomin/phoenix,0x00evil/phoenix,dmarkow/phoenix,jwarwick/phoenix,mitchellhenke/phoenix,Joe-noh/phoenix,rafbgarcia/phoenix,mitchellhenke/phoenix,nshafer/phoenix,cas27/phoenix,bsmr-erlang/phoenix,stevedomin/phoenix,optikfluffel/phoenix,phoenixframework/phoenix,ybur-yug/phoenix,mobileoverlord/phoenix,wsmoak/phoenix,jamilabreu/phoenix,jamilabreu/phoenix,mobileoverlord/phoenix,dmarkow/phoenix,Kosmas/phoenix,nshafer/phoenix,korobkov/phoenix,Ben-Evolently/phoenix,phoenixframework/phoenix,Kosmas/phoenix,trarbr/phoenix,ybur-yug/phoenix,evax/phoenix