Membrane.Testing.Assertions.assert_sink_buffer
You're seeing just the macro
assert_sink_buffer
, go back to Membrane.Testing.Assertions module for more information.
Link to this macro
assert_sink_buffer(pipeline, sink_name, pattern, timeout \\ 2000)
View Source (macro)Asserts that Membrane.Testing.Sink
with name sink_name
received or will
receive a buffer matching pattern
within the timeout
period specified in
milliseconds.
When the Membrane.Testing.Sink
is a part of Membrane.Testing.Pipeline
you
can assert whether it received a buffer matching provided pattern.
{:ok, pid} = Membrane.Testing.Pipeline.start_link(%Membrane.Testing.Pipeline.Options{
elements: [
....,
the_sink: %Membrane.Testing.Sink{}
]
})
You can match for exact value:
assert_sink_buffer(pid, :the_sink ,%Membrane.Buffer{payload: ^specific_payload})
You can also use pattern to extract data from the buffer:
assert_sink_buffer(pid, :sink, %Buffer{payload: <<data::16>> <> <<255>>})
do_something(data)