Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing Subscriptions #11

Open
acrogenesis opened this issue Mar 26, 2022 · 4 comments
Open

Testing Subscriptions #11

acrogenesis opened this issue Mar 26, 2022 · 4 comments

Comments

@acrogenesis
Copy link
Contributor

I'm having trouble updating the SubscriptionCase the absinthe book uses for testing the subscriptions. How are you testing your subscriptions?

06-chp.subscriptions/4-publish/test/support/subscription_case.ex

defmodule PlateSlateWeb.SubscriptionCase do
  @moduledoc """
  This module defines the test case to be used by
  subscription tests
  """

  use ExUnit.CaseTemplate

  using do
    quote do
      # Import conveniences for testing with channels
      use PlateSlateWeb.ChannelCase
      use Absinthe.Phoenix.SubscriptionTest, schema: PlateSlateWeb.Schema
      import Plug.Conn
      import Phoenix.ConnTest

      setup do
        {:ok, socket} =
          Phoenix.ChannelTest.connect(
            PlateSlateWeb.UserSocket,
            Application.get_env(:valiot_app, :token_helper).header
          )

        {:ok, socket} = Absinthe.Phoenix.SubscriptionTest.join_absinthe(socket)

        {:ok, socket: socket}
      end
    end
  end
end
@sax
Copy link
Collaborator

sax commented Mar 27, 2022

Oh yeah, that module is specific to Phoenix channels: https://github.com/absinthe-graphql/absinthe_phoenix/blob/master/lib/absinthe/phoenix/subscription_test.ex

We wound up building a test client using gun. Now that you bring it up, it would have made far more sense to have done that as a part of this library.

@austinworks do you think the test client could be added to this repo?

@maxsalven
Copy link

@sax any plans to add testing capabilities to this library?

@maxsalven
Copy link

Is there anything I can do to help?

@acrogenesis
Copy link
Contributor Author

@benwilson512 @sax hey now that the project is in absinthe-graphql org it might make sense to look into this again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants