Files
2025-07-16 20:39:30 +00:00

24 lines
858 B
Elixir

defmodule WandererApp.Test.PubSub do
@moduledoc """
Behaviour for PubSub functions used in the application.
This allows mocking of PubSub calls in tests.
"""
@callback broadcast(
server :: module() | pid(),
topic :: String.t(),
message :: any()
) ::
:ok | {:error, term()}
@callback broadcast!(
server :: module() | pid(),
topic :: String.t(),
message :: any()
) ::
:ok | {:error, term()}
@callback subscribe(topic :: String.t()) :: :ok | {:error, term()}
@callback subscribe(module :: atom(), topic :: String.t()) :: :ok | {:error, term()}
@callback unsubscribe(topic :: String.t()) :: :ok | {:error, term()}
@callback unsubscribe(module :: atom(), topic :: String.t()) :: :ok | {:error, term()}
end