Skip to content

Commit

Permalink
Add test for keep alive messages
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenvanvliet committed Apr 11, 2021
1 parent c94cd7a commit 1b54138
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/integration/subscription_transport_ws_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,26 @@ defmodule SubscriptionsTransportWS.Integration.SocketTest do
assert_receive %{"type" => "ka"}
end

test "continues to receive keep alive messages" do
{:ok, socket} =
WebsocketClient.start_link(
self(),
"ws://127.0.0.1:#{@port}/ws/websocket",
@json_module
)

WebsocketClient.send_event(socket, ~s({
"type": "connection_init",
"payload": {
"token": "correct"
}
}))
assert_receive %{"type" => "connection_ack"}

assert_receive %{"type" => "ka"}
assert_receive %{"type" => "ka"}
end

test "returns error for invalid graphql document" do
{:ok, socket} = WebsocketClient.start_link(self(), @path, @json_module)

Expand Down

0 comments on commit 1b54138

Please sign in to comment.