Last active
November 4, 2018 23:48
-
-
Save gen1321/a0845d372fe6d9eb0cc64101f78af53a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyAppWeb.SubscriptionTest do | |
use MyAppWeb.SubscriptionCase | |
@mutation """ | |
mutation createUser($email: String, $name: String){ | |
createUser(email: $email, name: $name){ | |
} | |
} | |
""" | |
@subscription """ | |
subscription { | |
userAdded { | |
name | |
} | |
} | |
""" | |
describe "subscription" do | |
test "sub with fufilment", %{socket: socket, conn: conn} do | |
assert %{ | |
payload: %{subscriptionId: sub_id}, | |
status: :ok | |
} = subscribe(socket, @subscription) | |
graphql(conn, "/api", @mutation, %{email: "test@example.com", name: "Boris"}) | |
expected = %{result: %{data: %{"userAdded" => %{"name" => "Boris"}}}} | |
assert_subscription_fulfilment fufilment | |
assert fufilment = expected | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment