Testing Subscriptions
Testing your API is important, and subscriptions are no exception. We’ve been using helpers from the PlateSlate.ConnCase module in our test to ease building HTTP-based integration tests; you’ll need a similar PlateSlate.SubscriptionCase module for managing the subscription integration tests via channels. While the ConnCase module gets generated by Phoenix when we first create the project, the SubscriptionCase module we’ll need to make ourselves.
| defmodule PlateSlateWeb.SubscriptionCase do |
| @moduledoc """ |
| This module defines the test case to be used by |
| subscription tests |
| """ |
| |
| use ExUnit.CaseTemplate |
| |
| using do |
| quote do |
| ... |
Get Craft GraphQL APIs in Elixir with Absinthe now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.