dashbitco / broadway

Concurrent and multi-stage data ingestion and data processing with Elixir
https://elixir-broadway.org
Apache License 2.0
2.44k stars 161 forks source link

[docs] The `Broadway.test_batch` example doesn't work with Broadway 1.0.3 #312

Closed moniquelive closed 2 years ago

moniquelive commented 2 years ago

The Broadway.test_batch example on this section doesn't work with Broadway 1.0.3 because the first parameter is a pid.

And test_batch uses the following guard to verify its first parameter:

  defguardp is_broadway_name(name)
            when is_atom(name) or (is_tuple(name) and tuple_size(name) == 3)

No pids. This one would work:

test "batch messages" do
  ref = Broadway.test_batch(MyBroadway, [1, 2, 3])
  assert_receive {:ack, ^ref, [%{data: 1}, %{data: 2}, %{data: 3}], []}, 1000
end

I can send a PR if you agree.

josevalim commented 2 years ago

Yes, please update the docs to use the Broadway name. :) PR is welcome!

moniquelive commented 2 years ago

My bad! It's fixed already. Somehow I landed on 1.0.0 docs. Sorry for the noise.

josevalim commented 2 years ago

Np, thanks for checking!