# `BB.Test.ParameterBridge`
[🔗](https://github.com/beam-bots/bb/blob/main/test/support/test_parameter_bridge.ex#L5)

Reference implementation of `BB.Bridge` for testing.

Records all calls for test assertions and provides controllable responses.

## Usage

    # Start robot with bridge
    start_supervised!(RobotWithBridge)
    bridge_pid = BB.Process.whereis(RobotWithBridge, :test_bridge)

    # Register to receive change notifications
    BB.Test.ParameterBridge.register_test_process(bridge_pid, self())

    # Simulate inbound requests from remote
    {:ok, params} = BB.Test.ParameterBridge.list_params(bridge_pid)
    {:ok, value} = BB.Test.ParameterBridge.get_param(bridge_pid, [:speed])
    :ok = BB.Test.ParameterBridge.set_param(bridge_pid, [:speed], 2.0)

    # Receive outbound change notifications
    assert_receive {:bridge_change, %BB.Parameter.Changed{}}

# `t`

```elixir
@type t() :: %BB.Test.ParameterBridge{
  calls: [{atom(), list()}],
  remote_params: %{required(BB.Bridge.param_id()) =&gt; term()},
  robot: module(),
  subscriptions: MapSet.t(BB.Bridge.param_id()),
  test_pid: pid() | nil
}
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `clear_calls`

Clear recorded calls.

# `get_calls`

Get all recorded calls.

# `get_param`

Get a parameter value (simulates inbound request from remote).

# `list_params`

List all parameters (simulates inbound request from remote).

# `register_test_process`

Register a test process to receive change notifications.

# `set_param`

Set a parameter value (simulates inbound request from remote).

# `set_remote_params`

Set up fake remote parameters for testing inbound remote access.

# `simulate_remote_change`

Simulate a remote parameter change (for testing subscriptions).

# `start_link`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
