# `Membrane.Testing.Sink`
[🔗](https://github.com/membraneframework/membrane-core/blob/v1.2.6/lib/membrane/testing/sink.ex#L1)

Sink Element that notifies the pipeline about buffers and events it receives.

By default `Sink` will demand buffers automatically, but you can override that
behaviour by using `autodemand` option. If set to false no automatic demands
shall be made. Demands can be then triggered by sending `{:make_demand, size}`
message.

This element can be used in conjunction with `Membrane.Testing.Pipeline` to
enable asserting on buffers and events it receives.

    alias Membrane.Testing
    links = [
        ... |>
        child(:sink, %Testing.Sink{}) |>
        ...
    ]
    {:ok, pid} = Testing.Pipeline.start_link(
      spec: links
    )

Asserting that `Membrane.Testing.Sink` element processed a buffer that matches
a specific pattern can be achieved using
`Membrane.Testing.Assertions.assert_sink_buffer/3`.

    assert_sink_buffer(pid, :sink ,%Membrane.Buffer{payload: 255})

## Element options

Passed via struct `t:Membrane.Testing.Sink.t/0`

- `autodemand`  

  ```
  boolean()
  ```
  
  Default value: `true`  
  If true element will automatically make demands.
  If it is set to false demand has to be triggered manually by sending `:make_demand` message.

## Pads

### `:input`

Accepted formats:
```
_any
```

Direction: | `:input`
Availability: | `:always`
Flow control: | `:manual`
Demand unit: | `:buffers`

# `t`

```elixir
@type t() :: %Membrane.Testing.Sink{autodemand: boolean()}
```

Struct containing options for `Membrane.Testing.Sink`

# `options`

```elixir
@spec options() :: keyword()
```

Returns description of options available for this module

---

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