Cyclium.Test.OutputCase (Cyclium v0.1.6)

Copy Markdown View Source

Test helpers for verifying output adapter contract compliance and a FakeOutputAdapter for use in integration tests.

Usage

defmodule MyApp.Adapters.SlackTest do
  use ExUnit.Case, async: true
  use Cyclium.Test.OutputCase

  test "delivers successfully" do
    payload = %{channel: "#alerts", message: "test"}
    ctx = %{episode_id: Ecto.UUID.generate()}

    assert_valid_deliver(MyApp.Adapters.Slack, :slack, payload, ctx)
  end
end

FakeOutputAdapter

setup do
  {:ok, _} = Cyclium.Test.FakeOutputAdapter.start_link()
  :ok
end

# After strategy converge delivers outputs:
deliveries = Cyclium.Test.FakeOutputAdapter.deliveries()

Summary

Functions

Assert that an adapter is registered for the given type.

Assert that adapter.deliver/3 returns a valid response shape.

Functions

assert_adapter_registered(type)

(macro)

Assert that an adapter is registered for the given type.

assert_valid_deliver(adapter, type, payload, ctx)

(macro)

Assert that adapter.deliver/3 returns a valid response shape.