Raxol.Test.Unit (Raxol v0.3.0)
View SourceProvides utilities for unit testing Raxol components and modules.
This module offers a comprehensive set of tools for:
- Component isolation and testing
- Event simulation and verification
- State management testing
- Render output validation
Example
defmodule MyComponent.Test do
use ExUnit.Case
use Raxol.Test.Unit
test_component "handles keyboard input", MyComponent do
event = keyboard_event(:enter)
result = simulate_event(component, event)
assert_state(component, %{text: ""})
assert_command_emitted(result, :submit)
end
end
Summary
Functions
Asserts that a command was emitted by the component.
Asserts that a specific event was handled by the component.
Asserts that a component's state matches the expected state.
Creates a custom event for testing.
Creates a keyboard event for testing.
Sets up a component for isolated testing with initial properties.
Simulates an event being sent to a component.
Creates a window event for testing.
Functions
Asserts that a command was emitted by the component.
Asserts that a specific event was handled by the component.
Asserts that a component's state matches the expected state.
Creates a custom event for testing.
Creates a keyboard event for testing.
Sets up a component for isolated testing with initial properties.
Simulates an event being sent to a component.
Returns the updated state and any emitted commands.
Creates a window event for testing.