diff --git a/packages/elixir-client/test/electric/client_test.exs b/packages/elixir-client/test/electric/client_test.exs index 01dfc5d136..3b3a2c2f5c 100644 --- a/packages/elixir-client/test/electric/client_test.exs +++ b/packages/elixir-client/test/electric/client_test.exs @@ -170,7 +170,7 @@ defmodule Electric.ClientTest do assert_receive {:stream, 2, up_to_date()} end - test "live: false should halt once snapshot is complete", ctx do + test "oneshot: true should halt once snapshot is complete", ctx do {:ok, id1} = insert_item(ctx) {:ok, id2} = insert_item(ctx) {:ok, id3} = insert_item(ctx) @@ -186,7 +186,7 @@ defmodule Electric.ClientTest do {:ok, id5} = insert_item(ctx) {:ok, id6} = insert_item(ctx) - stream = stream(ctx, live: false) + stream = stream(ctx, oneshot: true) events = stream |> Enum.into([]) diff --git a/packages/elixir-client/test/support/db_setup.ex b/packages/elixir-client/test/support/db_setup.ex index 452b846ecc..43287d0864 100644 --- a/packages/elixir-client/test/support/db_setup.ex +++ b/packages/elixir-client/test/support/db_setup.ex @@ -46,27 +46,21 @@ defmodule Support.DbSetup do %{utility_pool: utility_pool, pool: pool, db_conn: pool, tablename: tablename} end - def insert_item(%{db_conn: db, tablename: tablename}) do - insert_item(db, tablename) + def insert_item(%{db_conn: db, tablename: tablename}, opts \\ []) do + insert_item(db, tablename, opts) end - def insert_item(db_conn, tablename) do - id = UUID.uuid4() + def insert_item(db_conn, tablename, opts) do + id = Keyword.get(opts, :id, UUID.uuid4()) + value = Keyword.get(opts, :value, "Some title") %Postgrex.Result{num_rows: 1} = Postgrex.query!( db_conn, """ - INSERT INTO \"#{tablename}\" ( - id, - title - ) - VALUES ( - $1, - 'Some title' - ); + INSERT INTO \"#{tablename}\" (id, title) VALUES ($1, $2); """, - [UUID.string_to_binary!(id)] + [UUID.string_to_binary!(id), value] ) {:ok, id}