Skip to content

Commit e14b094

Browse files
committed
✅ Add test verifying all sink consumer factories
1 parent addb1a0 commit e14b094

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

test/sink_consumer_test.exs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
defmodule Sequin.SinkConsumerTest do
2+
use Sequin.DataCase, async: true
3+
4+
alias Sequin.Consumers
5+
alias Sequin.Consumers.SinkConsumer
6+
alias Sequin.Factory.ConsumersFactory
7+
8+
describe "sink consumer create_changeset/2" do
9+
test "all sinks have valid factories" do
10+
for sink_type <- Consumers.SinkConsumer.types() do
11+
attrs = ConsumersFactory.sink_consumer_attrs(type: sink_type)
12+
changeset = SinkConsumer.create_changeset(%SinkConsumer{}, attrs)
13+
errors = Sequin.Error.errors_on(changeset)
14+
assert changeset.valid?, "Sink #{sink_type} has invalid factory: #{inspect(errors)}"
15+
end
16+
end
17+
end
18+
end

test/support/factory/consumers_factory.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ defmodule Sequin.Factory.ConsumersFactory do
191191
endpoint_url: "http://127.0.0.1:7700",
192192
primary_key: "masterKey",
193193
index_name: Factory.word(),
194-
api_key: Factory.word()
194+
api_key: Factory.word(),
195+
routing_mode: "static"
195196
},
196197
attrs
197198
)

0 commit comments

Comments
 (0)