Packages
Multi-surface application runtime for Elixir. One TEA module renders to terminal, browser (LiveView), SSH, and MCP (agents). 30+ widgets, flexbox + CSS grid, AI agent runtime, distributed swarm with CRDTs, time-travel debugging, session recording, sandboxed REPL, and agentic commerce.
Current section
Files
Jump to
Current section
Files
lib/raxol/test/event_assertions.ex
defmodule Raxol.Test.EventAssertions do
@moduledoc """
Event-based assertion helpers for ExUnit tests.
Provides wrappers for assert_receive and refute_receive for event-driven code.
"""
import ExUnit.Assertions
@doc """
Asserts that a message matching the given pattern is received within the timeout.
"""
defmacro assert_event_received(pattern, timeout \\ 1000) do
quote do
assert_receive unquote(pattern), unquote(timeout)
end
end
@doc """
Refutes that a message matching the given pattern is received within the timeout.
"""
defmacro refute_event_received(pattern, timeout \\ 1000) do
quote do
refute_receive unquote(pattern), unquote(timeout)
end
end
end